PureBasic Forum
https://www.purebasic.fr/english/

[Done] PB5.71b1 SaveImage(16Bit) = #True
https://www.purebasic.fr/english/viewtopic.php?f=4&t=73059
Page 1 of 1

Author:  Regenduft [ Fri Jun 21, 2019 8:29 am ]
Post subject:  [Done] PB5.71b1 SaveImage(16Bit) = #True

When using SaveImage() with 16 bit color depth (which is NOT supported by PureBasic), then the function return #False for BMPs and no file is created. This is correct, but...

When doing the same with JPEG, JPEG200 or PNG, the function returns #True and a 24bpp file is being created! (although I actually can't prove it for JPEG2000, since I've got no appropriate sofware installed to check, I guess it's also true there)

By the way, the debugger will correctly complain for any format, that 16 bit is not a supported color depth.

Code:
UseJPEGImageEncoder()
UseJPEG2000ImageEncoder()
UsePNGImageEncoder()

CreateImage(0,32,32,32)
StartDrawing(ImageOutput(0))
Define c
For y = 0 To 31
  For x = 0 To 31
    RandomData(@c,4)
    Plot(x,y,c)
  Next
Next
StopDrawing()

;################################################
;################################################
dir$="D:\TEMPORÄR\"
;################################################
;################################################

Debug SaveImage( 0, dir$+"bmp.bmp", #PB_ImagePlugin_BMP     , 10, 16) ; -> returns 0, saves no file
Debug SaveImage( 0, dir$+"jpg.jpg", #PB_ImagePlugin_JPEG    , 10, 16) ; -> returns 1, saves 24bpp file
Debug SaveImage( 0, dir$+"jp2.jp2", #PB_ImagePlugin_JPEG2000, 10, 16) ; -> returns 1, saves 24bpp file
Debug SaveImage( 0, dir$+"png.png", #PB_ImagePlugin_PNG     , 10, 16) ; -> returns 1, saves 24bpp file

Author:  Fred [ Fri Jun 21, 2019 10:24 am ]
Post subject:  Re: [PB5.71b1] SaveImage(16Bit) = #True

Fixed.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/