add autorotate to heifload

and remove the ignore_transformations option
This commit is contained in:
John Cupitt 2019-01-30 13:17:36 +00:00
parent 622c08b562
commit 50a955e357
1 changed files with 11 additions and 13 deletions

View File

@ -63,10 +63,10 @@ typedef struct _VipsForeignLoadHeif {
int page; int page;
int n; int n;
/* Set to ignore transforms (flip, rotate, crop) stored in the file /* Set to apply image transforms (flip, rotate, crop) stored in the file
* header. * header.
*/ */
gboolean ignore_transformations; gboolean autorotate;
/* Context for this image. /* Context for this image.
*/ */
@ -463,7 +463,7 @@ vips_foreign_load_heif_generate( VipsRegion *or,
* separate? * separate?
*/ */
options = heif_decoding_options_alloc(); options = heif_decoding_options_alloc();
options->ignore_transformations = heif->ignore_transformations; options->ignore_transformations = !heif->autorotate;
error = heif_decode_image( heif->handle, &heif->img, error = heif_decode_image( heif->handle, &heif->img,
heif_colorspace_RGB, heif_chroma_interleaved_24bit, heif_colorspace_RGB, heif_chroma_interleaved_24bit,
options ); options );
@ -545,12 +545,11 @@ vips_foreign_load_heif_class_init( VipsForeignLoadHeifClass *class )
G_STRUCT_OFFSET( VipsForeignLoadHeif, n ), G_STRUCT_OFFSET( VipsForeignLoadHeif, n ),
-1, 100000, 1 ); -1, 100000, 1 );
VIPS_ARG_BOOL( class, "ignore_transformations", 4, VIPS_ARG_BOOL( class, "autorotate", 4,
_( "Ignore transformations" ), _( "Autorotate" ),
_( "Ignore input transformations" ), _( "Apply image transformations" ),
VIPS_ARGUMENT_OPTIONAL_INPUT, VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsForeignLoadHeif, G_STRUCT_OFFSET( VipsForeignLoadHeif, autorotate ),
ignore_transformations ),
FALSE ); FALSE );
} }
@ -731,7 +730,7 @@ vips_foreign_load_heif_buffer_init( VipsForeignLoadHeifBuffer *buffer )
* *
* * @page: %gint, page (top-level image number) to read * * @page: %gint, page (top-level image number) to read
* * @n: %gint, load this many pages * * @n: %gint, load this many pages
* * @ignore_transformations: %gboolean, ignore image transformations * * @autorotate: %gboolean, apply image transformations
* *
* Read a HEIF image file into a VIPS image. * Read a HEIF image file into a VIPS image.
* *
@ -746,8 +745,7 @@ vips_foreign_load_heif_buffer_init( VipsForeignLoadHeifBuffer *buffer )
* the page number of the primary. * the page number of the primary.
* *
* HEIF images can have trsnaformations like rotate, flip and crop stored in * HEIF images can have trsnaformations like rotate, flip and crop stored in
* the header. By default, these are applied during load. Set * the header. Set @autorotate %TRUE to apply these during load.
* @ignore_transformations %TRUE to return the untransformed image.
* *
* See also: vips_image_new_from_file(). * See also: vips_image_new_from_file().
* *
@ -777,7 +775,7 @@ vips_heifload( const char *filename, VipsImage **out, ... )
* *
* * @page: %gint, page (top-level image number) to read * * @page: %gint, page (top-level image number) to read
* * @n: %gint, load this many pages * * @n: %gint, load this many pages
* * @ignore_transformations: %gboolean, ignore image transformations * * @autorotate: %gboolean, apply image transformations
* *
* Read a HEIF image file into a VIPS image. * Read a HEIF image file into a VIPS image.
* Exactly as * Exactly as