start trying to fix autorotate for heif images
This commit is contained in:
parent
27f1d28b61
commit
f209870e7b
@ -32,9 +32,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
#define DEBUG_VERBOSE
|
||||||
|
*/
|
||||||
#define VIPS_DEBUG
|
#define VIPS_DEBUG
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -323,27 +324,29 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
|||||||
enum heif_color_profile_type profile_type =
|
enum heif_color_profile_type profile_type =
|
||||||
heif_image_handle_get_color_profile_type( heif->handle );
|
heif_image_handle_get_color_profile_type( heif->handle );
|
||||||
|
|
||||||
|
printf( "profile type = " );
|
||||||
switch( profile_type ) {
|
switch( profile_type ) {
|
||||||
case heif_color_profile_type_not_present:
|
case heif_color_profile_type_not_present:
|
||||||
printf( "no profile\n" );
|
printf( "none" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case heif_color_profile_type_nclx:
|
case heif_color_profile_type_nclx:
|
||||||
printf( "nclx profile\n" );
|
printf( "nclx" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case heif_color_profile_type_rICC:
|
case heif_color_profile_type_rICC:
|
||||||
printf( "rICC profile\n" );
|
printf( "rICC" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case heif_color_profile_type_prof:
|
case heif_color_profile_type_prof:
|
||||||
printf( "prof profile\n" );
|
printf( "prof" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf( "unknown profile type\n" );
|
printf( "unknown" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
printf( "\n" );
|
||||||
}
|
}
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
@ -383,8 +386,12 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
|||||||
#ifdef HAVE_EXIF
|
#ifdef HAVE_EXIF
|
||||||
if( !heif->autorotate ) {
|
if( !heif->autorotate ) {
|
||||||
if( angle == VIPS_ANGLE_D90 ||
|
if( angle == VIPS_ANGLE_D90 ||
|
||||||
angle == VIPS_ANGLE_D270 )
|
angle == VIPS_ANGLE_D270 ) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf( "swapping width/height\n" );
|
||||||
|
#endif /*DEBUG*/
|
||||||
VIPS_SWAP( int, image_page_width, image_page_height );
|
VIPS_SWAP( int, image_page_width, image_page_height );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vips_autorot_remove_angle( out );
|
vips_autorot_remove_angle( out );
|
||||||
@ -894,6 +901,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
|
||||||
* * @autorotate: %gboolean, apply image transformations
|
* * @autorotate: %gboolean, apply image transformations
|
||||||
|
* * @thumbnail: %gboolean, fetch thumbnail instead of image
|
||||||
*
|
*
|
||||||
* Read a HEIF image file into a VIPS image.
|
* Read a HEIF image file into a VIPS image.
|
||||||
*
|
*
|
||||||
@ -907,9 +915,12 @@ vips_foreign_load_heif_buffer_init( VipsForeignLoadHeifBuffer *buffer )
|
|||||||
* HEIF images have a primary image. The metadata item `heif-primary` gives
|
* HEIF images have a primary image. The metadata item `heif-primary` gives
|
||||||
* 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 transformations like rotate, flip and crop stored in
|
||||||
* the header. Set @autorotate %TRUE to apply these during load.
|
* the header. Set @autorotate %TRUE to apply these during load.
|
||||||
*
|
*
|
||||||
|
* If @thumbnail is %TRUE, then fetch a stored thumbnail rather than the
|
||||||
|
* image.
|
||||||
|
*
|
||||||
* See also: vips_image_new_from_file().
|
* See also: vips_image_new_from_file().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, -1 on error.
|
* Returns: 0 on success, -1 on error.
|
||||||
@ -939,10 +950,10 @@ 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
|
||||||
* * @autorotate: %gboolean, apply image transformations
|
* * @autorotate: %gboolean, apply image transformations
|
||||||
|
* * @thumbnail: %gboolean, fetch thumbnail instead of image
|
||||||
*
|
*
|
||||||
* Read a HEIF image file into a VIPS image.
|
* Read a HEIF image file into a VIPS image.
|
||||||
* Exactly as
|
* Exactly as vips_heifload(), but read from a memory buffer.
|
||||||
* vips_heifload(), but read from a memory buffer.
|
|
||||||
*
|
*
|
||||||
* You must not free the buffer while @out is active. The
|
* You must not free the buffer while @out is active. The
|
||||||
* #VipsObject::postclose signal on @out is a good place to free.
|
* #VipsObject::postclose signal on @out is a good place to free.
|
||||||
|
@ -836,8 +836,8 @@ class TestForeign:
|
|||||||
def heif_valid(im):
|
def heif_valid(im):
|
||||||
a = im(10, 10)
|
a = im(10, 10)
|
||||||
assert_almost_equal_objects(a, [75.0, 86.0, 81.0])
|
assert_almost_equal_objects(a, [75.0, 86.0, 81.0])
|
||||||
assert im.width == 4032
|
assert im.width == 3024
|
||||||
assert im.height == 3024
|
assert im.height == 4032
|
||||||
assert im.bands == 3
|
assert im.bands == 3
|
||||||
|
|
||||||
self.file_loader("heifload", HEIC_FILE, heif_valid)
|
self.file_loader("heifload", HEIC_FILE, heif_valid)
|
||||||
|
Loading…
Reference in New Issue
Block a user