After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 335615 - TIFF offset information is not retained
TIFF offset information is not retained
Status: RESOLVED DUPLICATE of bug 419578
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other All
: Normal enhancement
: Future
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-03-23 06:55 UTC by Adam Buchbinder
Modified: 2013-10-27 22:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
TIFF image with offset tags set. (10.80 KB, image/tiff)
2006-03-23 07:27 UTC, Adam Buchbinder
Details

Description Adam Buchbinder 2006-03-23 06:55:10 UTC
Please describe the problem:
When using hugin, images are distorted to fit on a large canvas. Normally, each
image is output on a large, blank canvas. To save space, these images can be
output as files not much larger than the original, with offset information
embedded. Sometimes, these images need to have their alpha channels edited to
fine-tune them. However, editing the alpha channels in the Gimp destroys that
offset information.

Steps to reproduce:
1. Create a panorama with hugin. Set it to generate multiple cropped TIFF files.
2. Stitch these with enblend; the result will be fine.
3. Load and save one of the source TIFFs with Gimp.
4. Stitch these with enblend.


Actual results:
The offset information will have been clobbered, and the result will be incorrect.

Expected results:
The offset information should be retained, as long as no cropping or resizing of
the image has occurred.

Does this happen every time?
Yes; this is repeatable.

Other information:
I'm aware that not everyone has a copy of hugin; small sample images will be
attached to this bug.
Comment 1 Adam Buchbinder 2006-03-23 07:04:53 UTC
Output from enblend, before editing:

$ enblend -v -z barnscene0000.tif barnscene0001.tif -o test.tif
Input image "barnscene0000.tif" RGB UINT8 position=8429x0 size=2294x3549
Input image "barnscene0001.tif" RGB UINT8 position=6654x0 size=2440x3549

and after editing:

$ enblend -v -z barnscene0000.tif barnscene0001.tif -o test2.tif
Input image "barnscene0000.tif" RGB UINT8 position=0x0 size=2294x3549
Input image "barnscene0001.tif" RGB UINT8 position=0x0 size=2440x3549

The relevant bit from the vigra library included with enblend-2.5 is in src/vigra_impex/tiff.cxx:

        // XPosition
        if (TIFFGetField( tiff, TIFFTAG_XPOSITION, &fvalue )) {
            fvalue = fvalue * x_resolution;
            position.x = (int)floor(fvalue + 0.5);
        }
        // YPosition
        if (TIFFGetField( tiff, TIFFTAG_YPOSITION, &fvalue )) {
            fvalue = fvalue * y_resolution;
            position.y = (int)floor(fvalue + 0.5);
        }
Comment 2 Adam Buchbinder 2006-03-23 07:27:42 UTC
Created attachment 61826 [details]
TIFF image with offset tags set.

$ enblend -v -z tmp-scene-0000.tif -o tmp.tif
enblend: only one input file given. Enblend needs two or more overlapping input images in order to do blending calculations. The output will be the same as the input.Input image "tmp-scene-0000.tif" RGB UINT8 position=157x0 size=43x66
Output image size: (157, 0) -> (200, 66) = (43 x 66)
Loading next image: tmp-scene-0000.tif
assembled images bounding box: (3, 2) -> (43, 64)
Comment 3 Sven Neumann 2006-03-23 11:34:16 UTC
The way to implement this in GIMP would be to offset the layer according to the offset information and to store the layer offset in the TIFF file when saving. 
Comment 4 Adam Buchbinder 2006-03-23 15:20:45 UTC
PNG also supports this; should I file a separate bug for it, or can it be folded into this request?

The relevant code from src/vigra_impex/png.cxx:

        // read offset
        position.x = png_get_x_offset_pixels( png, info );
        position.y = png_get_y_offset_pixels( png, info );
Comment 5 Mukund Sivaraman 2007-05-05 08:20:08 UTC
Some commented out code has been added to the respective plug-ins. Basically a workflow dialog has to be added to the tiff-load plug-in, asking whether the offset info has to be used or not, as there are TIFFs out there with bad offsets. We have decided to put this off till after the 2.4 release as it's too late to add it in 2.3.x now.

Comment 6 Michael Natterer 2013-10-27 22:25:47 UTC
Resolving as duplicate of bug 419578 which has patches.

*** This bug has been marked as a duplicate of bug 419578 ***