Map-Projections icon indicating copy to clipboard operation
Map-Projections copied to clipboard

Add .TIFF Import Support to MapDesignerRaster.jar

Open oDinZu opened this issue 10 months ago • 3 comments

I exported a TIFF from QIS software and would like to import that format into Map-Designer via the Input button.

According to some research, high quality printing is best suited for the .TIFF format.

oDinZu avatar Feb 15 '25 23:02 oDinZu

I'd like to implement this eventually, but probably won't have time for a while. For now, I would suggest converting to a PNG, as it should give you a similar level of print quality as TIFF. QGIS might be able to export PNG, and if not you can convert TIFF to PNG using an image editor like paint.net.

jkunimune avatar Feb 16 '25 14:02 jkunimune

I have done little Java programming, but how challenging is it for me to implement TIFF support in the code? I guess I need to add another plugin for TIFF support and add TIFF support for types. I am hoping the current import being used supports .TIFF formatting.

From a bit of research, someone said JAI could be imported. https://www.oracle.com/java/technologies/advanced-imaging-api.html

I changed this in MapDesignerRaster.java:

	private static final FileChooser.ExtensionFilter[] READABLE_TYPES = {
			new FileChooser.ExtensionFilter("All image types", "*.png","*.jpg","*.jpeg","*.jpe","*.jfif","*.gif"),
			new FileChooser.ExtensionFilter("PNG", "*.png"),
			new FileChooser.ExtensionFilter("JPG", "*.jpg","*.jpeg","*.jpe","*.jfif"),
			new FileChooser.ExtensionFilter("GIF", "*.gif"),
                       new FileChooser.ExtensionFilter("TIFF", "*.tiff") };

	private static final FileChooser.ExtensionFilter[] RASTER_TYPES = {
			new FileChooser.ExtensionFilter("PNG", "*.png"),
			new FileChooser.ExtensionFilter("JPG", "*.jpg"),
			new FileChooser.ExtensionFilter("GIF", "*.gif"),
                       new FileChooser.ExtensionFilter("TIFF", "*.tiff") };

Then relaunched the application, but didn't discover any changes on input or output..I am guessing I need to recompile and build the app..but I don't have the env setup to do Java programming.

When I check the metadata of the TIFF, I get lots more yummy details that are important for printing in high quality, however a PNG would suffice if need bees.

exiftool ./Pictures/WORLD-MAPS/oDinZu_Infinity_Equilateral_HD_31000_1700-DPI_Fav-2.tiff
ExifTool Version Number         : 13.19
File Name                       : oDinZu_Infinity_Equilateral_HD_31000_1700-DPI_Fav-2.tiff
Directory                       : ./Pictures/WORLD-MAPS
File Size                       : 947 MB
File Modification Date/Time     : 2025:02:25 12:21:56-08:00
File Access Date/Time           : 2025:02:25 12:21:53-08:00
File Inode Change Date/Time     : 2025:02:25 12:21:57-08:00
File Permissions                : -rw-r--r--
File Type                       : TIFF
File Type Extension             : tif
MIME Type                       : image/tiff
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 31592
Image Height                    : 14910
Bits Per Sample                 : 8 8 8 8
Compression                     : LZW
Photometric Interpretation      : RGB
Strip Offsets                   : (Binary data 4440 bytes, use -b option to extract)
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 4
Rows Per Strip                  : 33
Strip Byte Counts               : (Binary data 3592 bytes, use -b option to extract)
X Resolution                    : 1700
Y Resolution                    : 1700
Planar Configuration            : Chunky
Resolution Unit                 : inches
Software                        : IGSC
Artist                          : oDinZu WenKi(CHARLES)
Extra Samples                   : Unassociated Alpha
XMP Toolkit                     : Image::ExifTool 13.19
Location                        : Lumærieantis, USA
License                         : GPL-3.0
Description                     : A HD Equilateral World Map Rendered With QGIS.
Current IPTC Digest             : e31bf1fe05fc6c0ba9eda14ee3d9d6a1
Application Record Version      : 4
Image Size                      : 31592x14910
Megapixels                      : 471.0

in comparison to a PNG metadata,

ExifTool Version Number         : 13.19
File Name                       : oDinZu_Infinity_Equilateral_HD_31000_1700-DPI_Fav-2.png
Directory                       : ./Pictures/WORLD-MAPS
File Size                       : 545 MB
File Modification Date/Time     : 2025:02:18 15:57:13-08:00
File Access Date/Time           : 2025:02:25 09:36:33-08:00
File Inode Change Date/Time     : 2025:02:18 15:57:13-08:00
File Permissions                : -rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 31160
Image Height                    : 14723
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Pixels Per Unit X               : 66929
Pixels Per Unit Y               : 66929
Pixel Units                     : meters
Artist                          : oDinZu WenKi(CHARLES)
Software                        : IGSC
XMP Toolkit                     : Image::ExifTool 13.19
Location                        : Lumærieantis, USA
License                         : GPL-3.0
Description                     : An Equilateral World Map.
Image Size                      : 31160x14723
Megapixels                      : 458.8

oDinZu avatar Feb 25 '25 20:02 oDinZu

Yes, a library would need to be found and imported to support TIFF. It appears javax.imageio has a TIFF plugin, which would probably make the most sense since javax.imageio is what I'm using now. The bigger issue, though, is that in order to write metadata when you save the map, you first need to load and store that metadata from the input image, which the current code doesn't do.

If you want to implement it yourself and send me the code or submit a pull-request, I'd be happy to incorporate it. You would need the ability to compile the app. Up to you, but personally I doubt that metadata is very important and think a PNG will work fine for your purposes.

jkunimune avatar Feb 25 '25 21:02 jkunimune