#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 , 10 years ago
Keywords: | png compression added |
---|---|
Milestone: | → 14.09 |
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:5 by , 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 , 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 , 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 , 10 years ago
We already did that the idea of this ticket is to optimize even further :)
comment:10 by , 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:12 by , 10 years ago
Regarding the transparency issue - there is surely another older ticket for this as this was a long standing bug.
follow-up: 18 comment:16 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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 , 10 years ago
Cc: | added |
---|
comment:19 by , 10 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 , 10 years ago
Copy original image over to images_nodist
then use whatever is smaller: optimized svg+zip compression from the jar or optimized png.
follow-up: 22 comment:21 by , 10 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)
Tool | Size |
---|---|
Original | 9920 |
Scour | 4247 |
svgo | 3310 |
svgcleaner | 2551 |
follow-up: 23 comment:22 by , 10 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)
Tool Size Original 9920 Scour 4247 svgo 3310 svgcleaner 2551
The zipped file size is what matters, but I guess it looks similar.
follow-up: 24 comment:23 by , 10 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.
comment:24 by , 10 years ago
follow-up: 28 comment:25 by , 10 years ago
There are missing icons at Help/Plugin/Wikipedia after [7668]
follow-up: 29 comment:28 by , 10 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.
comment:29 by , 10 years ago
Replying to stoecker:
The above two?
Yes, the two at point 8 in the section Recommended Usage at the linked page.
follow-up: 31 comment:30 by , 10 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.
comment:31 by , 10 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 , 10 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.
comment:33 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:34 by , 10 years ago
So there is nothing special to consider when uploading new png/svg images to josm/osm svn?
comment:35 by , 10 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.
In 7491/josm: