Modify

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#10479 closed enhancement (fixed)

Optimising images would save 250KB

Reported by: Stereo Owned by: team
Priority: normal Milestone: 14.09
Component: Core Version:
Keywords: png compression Cc: Klumbumbus

Description

Running https://imageoptim.com on https://josm.openstreetmap.de/svn/trunk saves 14.7% on average on every image, and up to 94.7%. Altogether, this saves 250.2KB

Optimising the images in the plugins would probably achieve similar gains.

Attachments (0)

Change History (36)

comment:1 by Don-vip, 10 years ago

Keywords: png compression added
Milestone: 14.09

comment:2 by Don-vip, 10 years ago

Resolution: fixed
Status: newclosed

In 7491/josm:

fix #10479 - optimize PNG/JPG images

comment:3 by Don-vip, 10 years ago

In 7492/josm:

see #10479 - revert changes on data_nodist/*.jpg (we need EXIF information here)

comment:4 by naoliv, 10 years ago

Resolution: fixed
Status: closedreopened

Something is broken with the PNG files:

http://i.imgur.com/mvUBw5N.png

comment:5 by Stereo, 10 years ago

Maybe these png files relied on their alpha channel. The other button images manage to stay transparent after optimisation, I wonder what the difference is?

comment:6 by Don-vip, 10 years ago

I have checked source:trunk/images/misc/sticky.png. This is a tricky case. The file is transparent and valid according to PNG standard.

The optimization has changed the format from paletted+tRNS to truecolor+tRNS.

But here comes javabug:6788458: tRNS chunk is ignored by Java if the image is not indexed (paletted).

Either I revert the impacted files or implement a workaround to this problem.

comment:7 by naoliv, 10 years ago

Just use the plain optipng program (and not imageoptim) for all files and they should be good, from what I see here.

comment:8 by Don-vip, 10 years ago

We already did that the idea of this ticket is to optimize even further :)

comment:9 by Don-vip, 10 years ago

Resolution: fixed
Status: reopenedclosed

In 7495/josm:

fix #10479 - proper handling of transparent files

comment:10 by Don-vip, 10 years ago

Here is a non-exhaustive list of impacted files, it seems to work fine now:

DEBUG: Transparency has been forced for image dialogs/autoscale/problem.png
DEBUG: Transparency has been forced for image presets/memorial.png
DEBUG: Transparency has been forced for image presets/way_secondary.png
DEBUG: Transparency has been forced for image dialogs/validator.png
DEBUG: Transparency has been forced for image presets/ford.png
DEBUG: Transparency has been forced for image presets/waypoints.png
DEBUG: Transparency has been forced for image presets/Stop.png
DEBUG: Transparency has been forced for image presets/bollard.png
DEBUG: Transparency has been forced for image presets/lift_gate.png
DEBUG: Transparency has been forced for image presets/swing_gate.png
DEBUG: Transparency has been forced for image presets/stile.png
DEBUG: Transparency has been forced for image presets/waterfall.png
DEBUG: Transparency has been forced for image presets/chair_lift.png
DEBUG: Transparency has been forced for image presets/interpolation.png
DEBUG: Transparency has been forced for image presets/taxiway.png
DEBUG: Transparency has been forced for image presets/biergarten.png
DEBUG: Transparency has been forced for image presets/townhall.png
DEBUG: Transparency has been forced for image presets/fire_hydrant.png
DEBUG: Transparency has been forced for image presets/baker.png
DEBUG: Transparency has been forced for image presets/laundry.png
DEBUG: Transparency has been forced for image presets/stationery.png
DEBUG: Transparency has been forced for image presets/book.png
DEBUG: Transparency has been forced for image presets/travel.png
DEBUG: Transparency has been forced for image presets/addresses.png
DEBUG: Transparency has been forced for image logo_32x32x8.png
DEBUG: Transparency has been forced for image cursor/modifier/zoom.png
DEBUG: Transparency has been forced for image misc/sticky.png
DEBUG: Transparency has been forced for image misc/close.png
DEBUG: Transparency has been forced for image dialogs/layerlist/eye-translucent.png
DEBUG: Transparency has been forced for image dialogs/layerlist/eye-pressed.png
DEBUG: Transparency has been forced for image dialogs/duplicatelayer.png

comment:11 by Don-vip, 10 years ago

In 7499/josm:

fix #10479 - handle transparency for paletted images

comment:12 by stoecker, 10 years ago

Regarding the transparency issue - there is surely another older ticket for this as this was a long standing bug.

comment:13 by Don-vip, 10 years ago

Indeed I forgot it: #1576. It is fixed with r7499.

comment:14 by Don-vip, 10 years ago

In 7519/josm:

see #10479, see #10491 - optimize notes images

comment:15 by stoecker, 10 years ago

In 7595/josm:

see #10479 - fix transparency also for 'data:' loading mode

comment:16 by stoecker, 9 years ago

Resolution: fixed
Status: closedreopened

Now we have svg images which are wasting a lot of space. The tool svgcleaner-cli can compress them a lot. Should we use it? The Styles/Rules/Presets/Plugin icon handling/parser already uses it.

comment:17 by Klumbumbus, 9 years ago

Cc: Klumbumbus added

in reply to:  16 comment:18 by Don-vip, 9 years ago

Is it a tool provided in Debian/Ubuntu repositories? I can't find it.

comment:19 by naoliv, 9 years ago

Debian and Ubuntu have python-scour:

 Scour is a Python module that aggressively cleans SVG files, removing a lot of
 unnecessary information that certain tools or authors embed into their
 documents.  The goal of scour is to provide an identically rendered image
 (i.e. a scoured document should have no discernable visible differences from
 the original file) while minimizing the file size.

 WARNING: Scour is intended to be run on files that have been edited in Vector
 Graphics editors such as Inkscape or Adobe Illustrator.  Scour attempts to
 optimize the file, and as result, it will change the file's structure and
 (possibly) its semantics.  If you have hand-edited your SVG files, you will
 probably not be happy with the output of Scour.

comment:20 by bastiK, 9 years ago

Copy original image over to images_nodist then use whatever is smaller: optimized svg+zip compression from the jar or optimized png.

comment:21 by stoecker, 9 years ago

Is it a tool provided in Debian/Ubuntu repositories? I can't find it.

No. I installed the prebuild .deb by hand from the Launchpad repository as I didn't want to add another source.

Copy original image over to images_nodist then use whatever is smaller: optimized svg+zip compression from the jar or optimized png.

I'd simply make the optipng and svgcleaner part of the build process. That means we have small release but don't need to take care for the SVN. As said I already do this for the embedded icons of the Styles/Rules/Presets/Plugin data file.

Here a short quality example (trunk/images_nodist/uploadproperties.svg)

ToolSize
Original 9920
Scour 4247
svgo 3310
svgcleaner 2551

in reply to:  21 ; comment:22 by bastiK, 9 years ago

Replying to stoecker:

I'd simply make the optipng and svgcleaner part of the build process. That means we have small release but don't need to take care for the SVN.

Okay, but for excessively large svg, we could consider shipping the rendered png instead.

Here a short quality example (trunk/images_nodist/uploadproperties.svg)

ToolSize
Original 9920
Scour 4247
svgo 3310
svgcleaner 2551

The zipped file size is what matters, but I guess it looks similar.

in reply to:  22 ; comment:23 by stoecker, 9 years ago

Replying to bastiK:

Okay, but for excessively large svg, we could consider shipping the rendered png instead.

Actually I think our goal should be to have vector everywhere, so that we can adapt to higher screen sizes.

in reply to:  23 comment:24 by skyper, 9 years ago

Replying to stoecker:

Replying to bastiK:

Okay, but for excessively large svg, we could consider shipping the rendered png instead.

Actually I think our goal should be to have vector everywhere, so that we can adapt to higher screen sizes.

+1

comment:25 by Klumbumbus, 9 years ago

There are missing icons at Help/Plugin/Wikipedia after [7668]

comment:26 by bastiK, 9 years ago

Stuff in images/markers/* is still used, see Marker.java.

comment:27 by stoecker, 9 years ago

In 7672/josm:

see #10479 - readd two markers and their keep-alive code

in reply to:  25 ; comment:28 by stoecker, 9 years ago

Replying to Klumbumbus:

There are missing icons at Help/Plugin/Wikipedia after [7668]

Then the missing ones need to be added to wikipedia plugin. :-)

The above two? I find no other icon reference in wikipedia plugin.

in reply to:  28 comment:29 by Klumbumbus, 9 years ago

Replying to stoecker:

The above two?

Yes, the two at point 8 in the section Recommended Usage at the linked page.

comment:30 by stoecker, 9 years ago

Ah, you mean the wiki page. Fixed it and the plugin as well. On the wiki page one of the icons was missing anyway, independent from my change.

in reply to:  30 comment:31 by Klumbumbus, 9 years ago

Replying to stoecker:

On the wiki page one of the icons was missing anyway, independent from my change.

You're right. I only checked the first one. The second one was deleted already 2 years ago :) http://josm.openstreetmap.de/log/josm/trunk/images/blankmenu.png?rev=7675&mode=path_history

comment:32 by stoecker, 9 years ago

Automated icon stripping is active from tomorrow (svg and png). Saves about 50KB on the final JAR. Please tell issues with the images if there are some. I didn't detect any with my test file.

Last edited 9 years ago by stoecker (previous) (diff)

comment:33 by stoecker, 9 years ago

Resolution: fixed
Status: reopenedclosed

comment:34 by Klumbumbus, 9 years ago

So there is nothing special to consider when uploading new png/svg images to josm/osm svn?

Last edited 9 years ago by Klumbumbus (previous) (diff)

comment:35 by stoecker, 9 years ago

So there is nothing special to consider when uploading new png/svg images to josm/osm svn?

Yes, that's the plan.

Current Status:

SVG salamander has a bug which breaks optimized SVG. I fixed it in my local copy and tried to report it here but actually they have the worst bug tracker I have ever seen. So ATM I disabled SVG cleaning again.

comment:36 by stoecker, 9 years ago

In 7676/josm:

update SVG code to current SVN (fix line endings), see #10479

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.