byteswap on ppm save, if necessary
this was missing, thanks ewelot see https://github.com/libvips/libvips/issues/1894
This commit is contained in:
parent
c0bace8f91
commit
6340e14303
@ -11,7 +11,7 @@
|
|||||||
- add missing read loops to spng, heif, giflib and ppm load [kleisauke]
|
- add missing read loops to spng, heif, giflib and ppm load [kleisauke]
|
||||||
- block zero width or height images from imagemagick load [Koen1999]
|
- block zero width or height images from imagemagick load [Koen1999]
|
||||||
- check for overflow in gifload height [lovell]
|
- check for overflow in gifload height [lovell]
|
||||||
- fix msb_first default in ppm load [ewelot]
|
- fix msb_first default in ppm load and save [ewelot]
|
||||||
|
|
||||||
6/9/20 started 8.10.2
|
6/9/20 started 8.10.2
|
||||||
- update magicksave/load profile handling [kelilevi]
|
- update magicksave/load profile handling [kelilevi]
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
* - add "bitdepth" param, cf. tiffsave
|
* - add "bitdepth" param, cf. tiffsave
|
||||||
* 27/6/20
|
* 27/6/20
|
||||||
* - add ppmsave_target
|
* - add ppmsave_target
|
||||||
|
* 20/11/20
|
||||||
|
* - byteswap on save, if necessary [ewelot]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -298,6 +300,19 @@ vips_foreign_save_ppm( VipsForeignSavePpm *ppm, VipsImage *image )
|
|||||||
vips_foreign_save_ppm_line_ascii :
|
vips_foreign_save_ppm_line_ascii :
|
||||||
vips_foreign_save_ppm_line_binary;
|
vips_foreign_save_ppm_line_binary;
|
||||||
|
|
||||||
|
/* 16 and 32-bit binary write might need byteswapping.
|
||||||
|
*/
|
||||||
|
if( !ppm->ascii &&
|
||||||
|
(image->BandFmt == VIPS_FORMAT_USHORT ||
|
||||||
|
image->BandFmt == VIPS_FORMAT_UINT) ) {
|
||||||
|
VipsImage *x;
|
||||||
|
|
||||||
|
if( vips__byteswap_bool( image, &x, !vips_amiMSBfirst() ) )
|
||||||
|
return( -1 );
|
||||||
|
VIPS_UNREF( image );
|
||||||
|
image = x;
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_sink_disc( image, vips_foreign_save_ppm_block, ppm ) )
|
if( vips_sink_disc( image, vips_foreign_save_ppm_block, ppm ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
@ -402,7 +417,7 @@ vips_foreign_save_ppm_class_init( VipsForeignSavePpmClass *class )
|
|||||||
|
|
||||||
VIPS_ARG_INT( class, "bitdepth", 15,
|
VIPS_ARG_INT( class, "bitdepth", 15,
|
||||||
_( "bitdepth" ),
|
_( "bitdepth" ),
|
||||||
_( "Write as a 1 bit image" ),
|
_( "set to 1 to write as a 1 bit image" ),
|
||||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||||
G_STRUCT_OFFSET( VipsForeignSavePpm, bitdepth ),
|
G_STRUCT_OFFSET( VipsForeignSavePpm, bitdepth ),
|
||||||
0, 1, 0 );
|
0, 1, 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user