Bug 249686 - [Graphical Editor] Export Diagram as Image in PNG/GIF instead of JPEG
Summary: [Graphical Editor] Export Diagram as Image in PNG/GIF instead of JPEG
Status: CLOSED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xsd (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Keith Chong CLA
QA Contact: Keith Chong CLA
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on:
Blocks:
 
Reported: 2008-10-04 15:19 EDT by Andrey Utkin CLA
Modified: 2008-12-17 13:43 EST (History)
4 users (show)

See Also:


Attachments
Patch (3.48 KB, patch)
2008-11-05 18:41 EST, Gabriel Indik CLA
valentinbaciu: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Utkin CLA 2008-10-04 15:19:45 EDT
Build ID: 3.4.1

Now "Export Diagram as Image" function creates image in JPEG format. This format best suited for photos but not for diagrams and texts. As result, exported diagram has "noise" because of JPEG`s quality loss effect. 

Please change format of exported image to GIF or PNG. Those formats has no quality loss effect.
Comment 1 Valentin Baciu CLA 2008-10-06 10:42:11 EDT
Amy, we may want to consider this for the WSDL editor as well.
Comment 2 Valentin Baciu CLA 2008-11-05 08:34:45 EST
I've been experimenting a bit and it seems to me we should be able to do png quite easily. There is a SWT.IMAGE_PNG format and the associated org.eclipse.swt.internal.image.PNGFileFormat will be used when saving.

GIF is another story. There is a org.eclipse.swt.internal.image.GIFFileFormat. We would need to reduce the color depth of the in memory image to one of the color depths supported by GIFs (2, 4 or 8 bits per pixel) - the GIFFileFormat will complain otherwise.
Comment 3 Gabriel Indik CLA 2008-11-05 18:41:32 EST
Created attachment 117155 [details]
Patch

Note that even though the constants for these formats were already being referenced in the image export utility, in the code a verification was made to ensure that only supported formats are selected. After a talk with Valentin and a set of tests, it has been verified that PNG and TIF formats are now supported, although as mentioned in the previous comment, the GIF format is not. The attached patch incorporates the supported formats. It also incorporates an improvement on file name character case handling that Valentin spotted, to ensure that the user can choose to write file extensions using lower and upper case letters. Note that this code is shared between the XML Schema editor and the WSDL editor, so applying this patch will resolve the issue on both tools.
Comment 4 Valentin Baciu CLA 2008-11-05 22:25:49 EST
Thank you Gabriel. Let's try to test this on Linux too to make sure all is good.

Keith, let's this patch committed/released for M4. 
Comment 5 Valentin Baciu CLA 2008-11-05 22:27:44 EST
Just noticed that the year part of the copyright will have to be updated.
Comment 6 Keith Chong CLA 2008-12-09 22:37:47 EST
TIFF doesn't seem to be supported with this fix.  I have removed the relevant sections from the patch.
Comment 7 Keith Chong CLA 2008-12-09 22:38:33 EST
Checked in for 3.1 M4.
Comment 8 Keith Chong CLA 2008-12-17 12:12:05 EST
Verified in wtp-sdk-S-3.1M4-20081215095735.
Comment 9 Valentin Baciu CLA 2008-12-17 13:43:27 EST
Closing.