Modify

Opened 4 weeks ago

Last modified 8 hours ago

#15476 reopened enhancement

[patch] Antialiased text and better resize quality when viewing photos

Reported by: naoliv Owned by: team
Priority: normal Milestone: 17.10
Component: Core image mapping Version:
Keywords: picture photo resize quality geoimage Cc:

Description

If possible, could we have antialiased text and a better resize algorithm when viewing photos in JOSM?

https://i.imgur.com/ByJiIWW.png

If we compare to the same picture displayed when seeing a GPX file we can see the difference:
https://i.imgur.com/eK94s29.png

JOSM:

Build-Date:2017-10-24 09:00:44
Revision:13034
Is-Local-Build:true

Identification: JOSM/1.5 (13034 SVN pt_BR) Linux Debian GNU/Linux testing (buster)
Memory Usage: 3267 MB / 6372 MB (440 MB allocated, but free)
Java version: 1.8.0_144-8u144-b01-1-b01, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1600x900, :0.1 1280x1024
Maximum Screen Size: 1600x1024
Java package: openjdk-8-jre:amd64-8u144-b01-1
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
VM arguments: [-Dawt.useSystemAAFontSettings=on]
Dataset consistency test: No problems found

Plugins:
+ Create_grid_of_ways (32699)
+ FastDraw (33583)
+ ImportImagePlugin (33563)
+ OpeningHoursEditor (33185)
+ PicLayer (33385)
+ RoadSigns (33579)
+ SimplifyArea (33004)
+ apache-commons (33668)
+ buildings_tools (33004)
+ conflation (0.5.5)
+ contourmerge (1032)
+ download_along (33710)
+ editgpx (33004)
+ ejml (32680)
+ geojson (66)
+ geotools (33380)
+ importvec (33564)
+ indoorhelper (33632)
+ jts (32699)
+ log4j (32699)
+ measurement (33088)
+ merge-overlap (33436)
+ opendata (33617)
+ pbf (33568)
+ pdfimport (33579)
+ poly (33570)
+ reverter (33572)
+ scripting (30775)
+ tageditor (33579)
+ todo (30303)
+ turnlanes (33294)
+ turnlanes-tagging (254)
+ turnrestrictions (33537)
+ undelete (33480)
+ utilsplugin2 (33704)

Attachments (2)

josm-r13123-geoimage-rendering-regression-from-13038.jpeg (37.6 KB) - added by cmuelle8 24 hours ago.
josm-r13123-geoimage-rendering-regression-from-13038.jpeg
josm-13038-geoimage-zoom-regression-fix-and-minor-usability-enhancements.patch (34.7 KB) - added by cmuelle8 12 hours ago.
josm-13038-geoimage-zoom-regression-fix-and-minor-usability-enhancements.patch

Download all attachments as: .zip

Change History (20)

comment:1 Changed 4 weeks ago by Don-vip

can you please attach the gpx file + the photo?

comment:2 Changed 4 weeks ago by Don-vip

Ah my bad, didn't see #15475

comment:3 Changed 4 weeks ago by naoliv

Yes, you can use the same example.
Sorry that I didn't refer to it.

comment:4 Changed 3 weeks ago by Don-vip

Milestone: 17.10

comment:5 Changed 3 weeks ago by Don-vip

Component: CoreCore image mapping

comment:6 Changed 3 weeks ago by Don-vip

Resolution: fixed
Status: newclosed

In 13038/josm:

fix #15476 - Antialiased text and better resize quality when viewing photos

comment:7 Changed 3 weeks ago by Don-vip

Should be ok now, please test :)

comment:8 Changed 3 weeks ago by naoliv

Much better now :-)
Thanks!

Changed 24 hours ago by cmuelle8

josm-r13123-geoimage-rendering-regression-from-13038.jpeg

comment:9 Changed 24 hours ago by cmuelle8

Keywords: geoimage added
Resolution: fixed
Status: closedreopened

r13038 produced regression bugs with visible artefacts when image scaling some images.

openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

For a test image see e.g. https://commons.wikimedia.org/wiki/File:Vaals-Bokkebosje_(1).JPG

The thumbnail scaling (best fit) worked, but then, on each zoom level until the default scaling is employed, results are often just a white rectangle or a displaced fraction of the image. See https://josm.openstreetmap.de/attachment/ticket/15476/josm-r13123-geoimage-rendering-regression-from-13038.jpeg and #15511.

Attached patch fixes the regression and also makes geoimage plugin more configurable through prefs (adjustable max zoom, zoom-step, click zooming with mouse buttons (e.g. if a mouse wheel is not present). It also handles images with larger dimensions and/or larger maximum scaling.

Last edited 15 hours ago by cmuelle8 (previous) (diff)

comment:10 Changed 24 hours ago by cmuelle8

Summary: Antialiased text and better resize quality when viewing photos[patch] Antialiased text and better resize quality when viewing photos
Type: enhancementdefect

comment:11 Changed 13 hours ago by cmuelle8

btw, what is the policy on malformed double prop in preferences? e.g. if user entered foo123.45bar instead of a valid double

prop.get() will throw an exception and log it as warning each time, before returning the default value of pref.
(the exception is caught and not promoted (thrown again) in AbstractProperty).

Should such malformed values be reset programmatically in a prefChangedListener?

    if (prop.get() == prop.getDefaultValue())
         prop.put(defaultValue);  // or prop.remove();

Or should that be left to the user to fix?
.. after all he will note that malformed value will not be in effect.
(I have not checked how its done over other parts of josm's code base, hence the question.)

Last edited 13 hours ago by cmuelle8 (previous) (diff)

Changed 12 hours ago by cmuelle8

josm-13038-geoimage-zoom-regression-fix-and-minor-usability-enhancements.patch

comment:12 Changed 12 hours ago by cmuelle8

comment:13 Changed 12 hours ago by cmuelle8

Related to this (and the progressive downscaling method imported by don-vip) there is
some more info here

eventually parts of twelvemonkeys lib might be worth looking at for import,
if there is a need to support more image formats or lanczos scaling.
its under BSD license and though source weighs a hefty 97 mb, zip compressed,
the compiled jars (common+jpeg) are around 0.5 mb to 1.0 mb.

comment:14 in reply to:  11 Changed 8 hours ago by Don-vip

Replying to cmuelle8:

what is the policy on malformed double prop in preferences? e.g. if user entered foo123.45bar instead of a valid double
Should that be left to the user to fix?

Yes. Advanced preferences, as their name suggest, are for users who must know what they are doing.

comment:15 Changed 8 hours ago by Don-vip

Thank you!
The patch looks nice, can you please just explain this property:

    private static final BooleanProperty AGPIFO_STYLE2 =
        new BooleanProperty("geoimage.agpifo-style-drag-and-zoom", false);

I need a small javadoc and understand why it is called "STYLE2".

comment:16 Changed 8 hours ago by Don-vip

In 13127/josm:

see #15476, fix #15511 - fix image scaling regression and makes geoimage feature more configurable through prefs (adjustable max zoom, zoom-step, click zooming with mouse buttons (e.g. if a mouse wheel is not present). Patch by cmuelle8

comment:17 Changed 8 hours ago by Don-vip

Type: defectenhancement

Switch back this ticket to enhancement. The defect part is traced in #15511.

comment:18 Changed 8 hours ago by Don-vip

@naoliv: can you please check and confirm it works for you too? :)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to naoliv
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.