@@ -694,12 +694,12 @@ vips_thumbnail_build( VipsObject *object )
694
694
695
695
/* In linear mode, we need to transform to a linear space before
696
696
* vips_resize().
697
- *
698
- * If we are doing colour management (there's an import profile),
699
- * then we use XYZ PCS as the resize space.
700
697
*/
701
698
have_imported = FALSE;
702
699
if ( thumbnail -> linear ) {
700
+ /* If we are doing colour management (there's an import
701
+ * profile), then we can use XYZ PCS as the resize space.
702
+ */
703
703
if ( in -> Coding == VIPS_CODING_NONE &&
704
704
(in -> BandFmt == VIPS_FORMAT_UCHAR ||
705
705
in -> BandFmt == VIPS_FORMAT_USHORT ) &&
@@ -717,7 +717,6 @@ vips_thumbnail_build( VipsObject *object )
717
717
"pcs" , VIPS_PCS_XYZ ,
718
718
NULL ) )
719
719
return ( -1 );
720
-
721
720
in = t [1 ];
722
721
723
722
have_imported = TRUE;
@@ -771,16 +770,16 @@ vips_thumbnail_build( VipsObject *object )
771
770
if ( vips_image_hasalpha ( in ) &&
772
771
hshrink != 1.0 &&
773
772
vshrink != 1.0 ) {
774
- g_info ( "premultiplying alpha" );
775
- if ( vips_premultiply ( in , & t [3 ], NULL ) )
776
- return ( -1 );
777
- have_premultiplied = TRUE;
778
-
779
773
/* vips_premultiply() makes a float image. When we
780
774
* vips_unpremultiply() below, we need to cast back to the
781
775
* pre-premultiplied format.
782
776
*/
777
+ g_info ( "premultiplying alpha" );
778
+ have_premultiplied = TRUE;
783
779
unpremultiplied_format = in -> BandFmt ;
780
+
781
+ if ( vips_premultiply ( in , & t [3 ], NULL ) )
782
+ return ( -1 );
784
783
in = t [3 ];
785
784
}
786
785
@@ -838,7 +837,7 @@ vips_thumbnail_build( VipsObject *object )
838
837
}
839
838
}
840
839
else if ( thumbnail -> export_profile ) {
841
- /* Not imported, but we are doing colourmanagement . Transform
840
+ /* Not imported, but we are doing colour management . Transform
842
841
* to the output space.
843
842
*/
844
843
g_info ( "transforming to %s" , thumbnail -> export_profile );
0 commit comments