Bug 81764 - FILESAVE: "Save graphic..." function saves JPEGs as PNGs
Summary: FILESAVE: "Save graphic..." function saves JPEGs as PNGs
Status: RESOLVED DUPLICATE of bug 60684
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.6.2 release
Hardware: All Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-25 22:07 UTC by kvr2007
Modified: 2015-01-18 04:37 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A file with an imported *.png image. (17.27 KB, application/vnd.oasis.opendocument.text)
2014-07-25 22:07 UTC, kvr2007
Details
Image output generated by Save Graphic... function in LO Writer; a png file with *.jpg extension. (5.88 KB, image/png)
2014-07-28 14:44 UTC, kvr2007
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kvr2007 2014-07-25 22:07:44 UTC
Created attachment 103476 [details]
A file with an imported *.png image.

When I use the Save Graphic context menu to save a picture from writer (imported from PNG or JPEG but not SVG) and choose JPEG in the drop-down menu the file is saved normally and normally previewed in Gwenview (KDE standard image editor). However, if I try to import it in GIMP this results in the following error:

JPEG image Message
Not a JPEG file: starts with 0x89 0x50

GIMP Message
Opening '/tmp/Pic3.jpg' failed:

raw image plug-In could not open image

The second message is probably from the default plugin used to open unidentified files in GIMP, while googling up the first message suggests that instead of writing a JPEG header LO writes a PNG header to the file. Moreover, if I change the file extention to *.png the file is opened in GIMP without any issues.

Steps to reproduce:
1) open the attached *.odt file
2) right-click on the ball image (courtesy of openclipart collection)
3) choose Save Graphic... and save the file as JPEG (choose from drop-down menu)
4) open Gimp and choose File>Open to open the image file and see the error
Comment 1 Joel Madero 2014-07-26 18:20:59 UTC
Thank you for reporting this issue! I have been able to confirm the issue on:
Version: 4.3.0.2
Platform :Ubuntu 14.04
DE: GNOME3

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Hi kvr -

So you attached an odt file that opens in writer but you set the component to DRAWING. Can you clarify here? When I open writer and follow your steps, I can open the exported jpeg fine in GIMP.


Marking as NEEDINFO, please clarify the above and then mark as UNCONFIRMED. Thanks!
Comment 2 kvr2007 2014-07-27 21:27:49 UTC
Hello, Joel!

 I'm sorry, but your comment is slightly confusing, were you able to reproduce the bug or not?
 I guess GIMP is not the best option to check the nature of the file (PNG or JPEG), so let's use the Unix "file" utility for further experiments (mine is version 5.09). If I run

file /path/to/exported/file.jpg

it says:

/path/to/exported/file.jpg: PNG image data, 64 x 64, 8-bit/color RGBA, non-interlaced

So it's not a jpg, but a png.

Speaking of DRAWING component. Well, my bad, maybe I put the bug in the wrong category. Where do you think I should put the bug which affects the image export function? I found this problem in Writer, Draw and Impress, but not Calc (there is no Save Graphic function in the context menu).
Comment 3 ign_christian 2014-07-28 04:56:52 UTC
(In reply to comment #2)
> So it's not a jpg, but a png.
I guess what you meant is the image embedded as PNG in ODT. Yes it is, shown in content.xml of the file:

<draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="paragraph" svg:width="3.351cm" svg:height="3.351cm" draw:z-index="0"><draw:image xlink:href="Pictures/1000020100000040000000400AE95537.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

Perhaps related to filesave bug in Impress (observed in SVG): https://bugs.freedesktop.org/show_bug.cgi?id=80849#c9

Could you please try daily build newer than 2014-07-23 ? David Tardon said that should be fixed.
Comment 4 kvr2007 2014-07-28 14:44:17 UTC
Created attachment 103595 [details]
Image output generated by Save Graphic... function in LO Writer; a png file with *.jpg extension.

Please see comment #4 about this file.
Comment 5 kvr2007 2014-07-28 14:46:02 UTC
I checked the issue in LO Writer version 4.3.1 from the current branch (Build ID 0cb7d753b6b51411ab8dd72eab79f855a1d21c4d), dated 28th of July, and the issue persists.

When I was making the test file, I added the picture in PNG format, so no wonder that it is embedded as a PNG. However if I try to EXPORT the picture from writer and choose JPEG as the output format the picture is nevertheless EXPORTED as a PNG, as we can see from the output of file utility. It looks like the Save Graphic function just changes the file extension from *.png to *.jpg without altering the file itself.

For clarity I included in the attachments the *.jpg file (output.jpg) that is generated by the Save Graphic function in LO writer. Again, its extension is *.jpg, however the file utility says, that it is a PNG.

Sorry! The attachment comment links to itself instead of linking to this comment.
Comment 6 ign_christian 2014-07-30 16:53:21 UTC
I'm sorry I misread this bug while dropping comment 4.

(In reply to comment #4)
> Created attachment 103595 [details]
> Image output generated by Save Graphic... function in LO Writer; a png file
> with *.jpg extension.
Just want to confirm that something wrong with the output file. Image Viewer (default viewer in Ubuntu) can't open that JPG file. 

Trying image insertion with the JPG file in Impress also fail with error message: "Image filter not found". Looks like a serious bug but I don't know correct method to verify the file format.

And I can reproduce from scratch with a PNG file. 

Tested with LO 4.2.6.2 - Ubuntu 12.04 x86

Component should be Writer as Joel said.
Comment 7 kvr2007 2014-07-31 00:49:57 UTC
Shall the bug be marked as confirmed?

Also, could you please check your test results with the console "file" utility (please see comment #2 for instructions). It should be quite correct, as far as I know.

Thanks!
Comment 8 ign_christian 2014-07-31 09:05:29 UTC
(In reply to comment #7)
> Also, could you please check your test results with the console "file"
> utility (please see comment #2 for instructions). It should be quite
> correct, as far as I know.
Yes, as you observed. But honestly I don't know correct method to verify the file format...just confirming that something wrong since Impress reject the file (surprisingly Writer does not reject the file).

I can also reproduce that issue (Save PNG Graphic as JPG) with Impress.

Perhaps we should wait others opinion to confim what is wrong here.
Comment 9 ign_christian 2014-08-01 10:25:31 UTC
This bug is closely similar to Bug 75786

Other related bugs: Bug 41345, Bug 60684
Comment 10 Veek.M 2014-08-07 03:55:40 UTC
works fine in Version: 4.2.5.2 Build ID: 420m0(Build:2) on Debian Wheezy Backports WITH 'Automatic File Name Extension'.
Comment 11 Veek.M 2014-08-07 04:02:10 UTC
err ignore above comment - bug EXISTS in Debian wheezy Backports 4.2.5.2.
deathstar> file -i klingon.jpg 
klingon.jpg: image/png; charset=binary
and GIMP-Image-Image Properties treats it as a png file
Comment 12 Matthew Francis 2015-01-18 04:37:58 UTC

*** This bug has been marked as a duplicate of bug 60684 ***