Skip to content

Commit

Permalink
set image orientation on write
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Jul 20, 2024
1 parent 5bbdfe2 commit b842e3a
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions coders/tga.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,27 @@ static MagickBooleanType WriteTGAImage(const ImageInfo *image_info,Image *image)
else
tga_info.colormap_size=24;
}
if ((image->orientation == BottomRightOrientation) ||
(image->orientation == TopRightOrientation))
tga_info.attributes|=(1UL << 4);
if ((image->orientation == TopLeftOrientation) ||
(image->orientation == TopRightOrientation))
tga_info.attributes|=(1UL << 5);
switch (image->orientation)
{
case BottomRightOrientation:
{
tga_info.attributes|=0x10;
break;
}
case UndefinedOrientation:
case TopLeftOrientation:
{
tga_info.attributes|=0x20;
break;
}
case TopRightOrientation:
{
tga_info.attributes|=0x30;
break;
}
default:
break;
}
value=GetImageArtifact(image,"tga:image-origin"); /* deprecated */
if (value != (const char *) NULL)
{
Expand Down

0 comments on commit b842e3a

Please sign in to comment.