Bug 193339 - Changing jpg to jpeg
Summary: Changing jpg to jpeg
Status: RESOLVED FIXED
Alias: None
Product: kolourpaint
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Unspecified
: NOR normal
Target Milestone: ---
Assignee: kolourpaint-support
URL:
Keywords:
: 194637 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-20 11:36 UTC by Dotan Cohen
Modified: 2009-06-05 13:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dotan Cohen 2009-05-20 11:36:11 UTC
Version:            (using KDE 4.2.3)
Installed from:    Ubuntu Packages

When opening *.jpg files in Kolourpaint, the application saves them as *jpeg instead of overwriting *.jpg.
Comment 1 Dario Andres 2009-05-20 20:27:13 UTC
Just investigating the code:

If you open a *.jpeg file first this also happens

This is why:
- JPEG is considered a format when you can specify a save quality
When you load a JPG image, it has an "invalid save quality" , so when you select "Save" the first time, it allows you to select the filename(if you want to change it) and the save quality.
- When you select Save a second time it works properly without asking.

The problem is: the default extension for the image/jpeg mimetype is "jpeg" (not "jpg"), so the save dialog uses that extension.

So... possible solutions:
- Assume a 100% save quality for the "Save"(not "Save as") action
- Force(or add) the "jpg" extension.
- Any other idea?

Thanks
Comment 2 Dotan Cohen 2009-05-20 21:13:11 UTC
> The problem is: the default extension for the image/jpeg mimetype
> is "jpeg" (not "jpg"), so the save dialog uses that extension.

I think that the best solution (not workaround) would be to either make a duplicate image/jpg mimetype, or if possible alias jpg to jpeg.

According to Google, there is an order of magnitude more photos named *.jpg than *.jpeg, so even switching the mimetype to image/jpg would be better than nothing:

http://www.google.com/search?q=jpeg
Results 1 - 20 of about 125,000,000 for jpeg

http://www.google.com/search?q=jpg
Results 1 - 20 of about 1,470,000,000 for jpg
Comment 3 Dario Andres 2009-05-20 21:34:45 UTC
Look at bug 176737.
Comment 4 Dotan Cohen 2009-05-21 08:10:33 UTC
Thank you Dario, I wonder why the BKO search did not turn that up!

It does appear that the bugs have the same root cause, though I am hesitant to mark this one as a dupe. I'll leave that decision up to a dev.
Comment 5 Dario Andres 2009-05-22 17:42:57 UTC
According to Pino both "jpeg" and "jpg" have both the same priority. Also, if we change the default to "jpg". If someone opens a .jpeg file , it will be prompted to save it as jpg. (and may be that is not what the user wants)
So I guess this could be fixed locally forcing the current extension on the first save file dialog (I need to investigate a bit...)
Comment 6 Dotan Cohen 2009-05-23 20:37:24 UTC
> So I guess this could be fixed locally forcing the
> current extension on the first save file dialog

Yes, that seems to be _the_solution_ as opposed to a workaround. Thanks.
Comment 7 Dario Andres 2009-05-30 16:27:55 UTC
*** Bug 194637 has been marked as a duplicate of this bug. ***
Comment 8 Dario Andres 2009-06-03 19:49:30 UTC
Ok, I managed to get a solution:

On the save dialog function, check the mimetype of the current filename, if it is the same as the "desired default mimetype", then, re-use the filename (instead of automatically assign other extension)

So, with a file "a.jpg" , it will detect that its mimetype is "image/jpg", and then it will set the save name on the file dialog to "a.jpg" (instead of the default "a.jpeg"). This will also honor the custom case on the extension (".JPG"/".JpG"/".JPeG", whatever)

However, changing the file type to anything else and change it back to JPEG Image will revert this extension.

But it is a good first approach.
I'm going to commit soon

BTW: I just tested with a JPG file renamed to use a png or bmp extension, and they were not recognized nor opened, so my fix will not affect this.
Comment 9 Dario Andres 2009-06-03 20:13:12 UTC
SVN commit 977265 by darioandres:

File save dialog behaviour fix:
Honor the current filename if its mimetype is the same as the current format
(honor "JPG" over "jpeg" if the file is named "foobar.JPG")

BUG: 193339


 M  +5 -0      kpMainWindow_File.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=977265
Comment 10 Dotan Cohen 2009-06-05 13:23:21 UTC
Thanks, Dario!