GraphicsMagick: coders/tga.c TGA reader seems to ignore image or...
GraphicsMagick Commits <[email protected]> Tue, 20 Feb 2024 15:07:31 -0600
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.12893.1708463265.19238.graphicsmagick-commit@lists.sourceforge.net> |
changeset 995b36e38939 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=995b36e38939 summary: coders/tga.c TGA reader seems to ignore image orientation, fixed now. diffstat: ChangeLog | 5 +++++ coders/tga.c | 38 +++++++++++++++++--------------------- coders/tiff.c | 4 ++-- 3 files changed, 24 insertions(+), 23 deletions(-) diffs (96 lines): diff -r 6e3959c6e2db -r 995b36e38939 ChangeLog --- a/ChangeLog Sun Feb 18 09:14:29 2024 -0600 +++ b/ChangeLog Tue Feb 20 22:07:01 2024 +0100 @@ -1,3 +1,8 @@ +2024-02-20 Fojtik Jaroslav <[email protected]> + + * coders/tga.c TGA reader seems to ignore image orientation, + fixed now. + 2024-02-18 Fojtik Jaroslav <[email protected]> * jpeg/*: Update JPEG builtin library to 9f. diff -r 6e3959c6e2db -r 995b36e38939 coders/tga.c --- a/coders/tga.c Sun Feb 18 09:14:29 2024 -0600 +++ b/coders/tga.c Tue Feb 20 22:07:01 2024 +0100 @@ -148,29 +148,24 @@ /* Color Correction Table - Field 27 (2K Bytes) */ } TGADevel; + +static OrientationType ConvOrientation(unsigned TgaOrientation) +{ + switch((TgaOrientation >> 4) & 3) + { + case 0: return BottomLeftOrientation; + case 1: return BottomRightOrientation; + case 2: return TopLeftOrientation; + case 3: return TopRightOrientation; + } + return UndefinedOrientation; +} + + static void LogTGAInfo(const TGAInfo *tga_info) { - OrientationType orientation = UndefinedOrientation; - unsigned int attribute_bits; - - attribute_bits = tga_info->attributes & 0xf; - - switch((tga_info->attributes >> 4) & 3) - { - case 0: - orientation=BottomLeftOrientation; - break; - case 1: - orientation=BottomRightOrientation; - break; - case 2: - orientation=TopLeftOrientation; - break; - case 3: - orientation=TopRightOrientation; - break; - } + const unsigned int attribute_bits = tga_info->attributes & 0xf; (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Targa Header:\n" @@ -199,7 +194,7 @@ tga_info->x_origin, tga_info->y_origin, tga_info->width, tga_info->height, (unsigned int) tga_info->bits_per_pixel, - tga_info->attributes,attribute_bits,OrientationTypeToString(orientation)); + tga_info->attributes, attribute_bits, OrientationTypeToString(ConvOrientation(tga_info->attributes))); } @@ -511,6 +506,7 @@ { if (image->logging) LogTGAInfo(&tga_info); + image->orientation = ConvOrientation(tga_info.attributes); if (EOFBlob(image)) ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image); diff -r 6e3959c6e2db -r 995b36e38939 coders/tiff.c --- a/coders/tiff.c Sun Feb 18 09:14:29 2024 -0600 +++ b/coders/tiff.c Tue Feb 20 22:07:01 2024 +0100 @@ -1,5 +1,5 @@ /* -% Copyright (C) 2003 - 2023 GraphicsMagick Group +% Copyright (C) 2003 - 2024 GraphicsMagick Group % Copyright (C) 2002 ImageMagick Studio % Copyright 1991-1999 E. I. du Pont de Nemours and Company % @@ -28,7 +28,7 @@ % Bob Friesenhahn % % 2002-2015 % % Jaroslav Fojtik % -% 2023 % +% 2023-2024 % % % % % % %