gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
277 stars 61 forks source link

write_jpeg and write_png produce black images on !version.release 8.2 #1832

Closed heinerbilling closed 5 months ago

heinerbilling commented 6 months ago

I write jpg-images with write_jpeg.pro in GDL !version.release '6.5' on a Linux-System using ImageMagick-6.9.7 After a system update I use GDL !!version.release '8.2' using ImageMagick-6.9.11 Here 3D- jpg-Images as well as png-Images are black. With read_jpeg these data are all . 2D Images are o.k. . Is this problem solved in later versions ? example: gdl a=dist(400) write_jpeg,'image.jpg',a ;image.jpg looks fine read_jpeg,'image.jpg',b help,max(b)

BYTE = 255 help,b B BYTE = Array[3, 400, 400] write_jpeg,'image.jpg',b,tr=1 help,max(c) BYTE = 0
alaingdl commented 6 months ago

OK, I just tested on the current Git version and I cannot reproduce your problem

GDL> a=dist(400)
% Compiled module: DIST.
GDL> write_jpeg,'image.jpg',a
% Compiled module: WRITE_JPEG.
GDL> read_jpeg,'image.jpg',b
GDL> help, a,b
A               FLOAT     = Array[400, 400]
B               BYTE      = Array[400, 400]

GDL> !gdl
{
    "RELEASE": "1.0.2-577-gcd1362cc",
    "BUILD_DATE": "May  3 2024",
    "EPOCH": 1714687200,
    "GDL_USE_DSFMT": 1,
    "GDL_USE_WX": 0,
    "GDL_POSIX": 1
}

No changes in read_jpeg.pro and write_jpeg.pro since 3 years ... Could you report the !gdl infos ? thanks

heinerbilling commented 6 months ago

Hello, Alain

Thank you for your quick reaction. GDL> !gdl { "RELEASE": "1.0.1", "BUILD_DATE": "Jan 13 2023", "EPOCH": 1673564400, "GDL_USE_DSFMT": 1, "GDL_USE_WX": 0, "GDL_POSIX": 1 } help, !version.release

STRING = '8.2' /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/modules-Q16/coders/magick.la 1740325 4 -rw-r--r-- 1 root root 974 Feb 12 21:15 In the older GDL Version GDL - GNU Data Language, Version 0.9.7 !gdl does not work. !version.realese was = '6.5' I found /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/modules-Q16/coders/magick.so 660383 212 -rw-r--r-- 1 root root 215312 Jan 11 2021 There I get the % WARNING: your version of the GraphicsMagick library will truncate images to 16 bits per pixel Probably, we have a different version of ImageMagick This WARNING does no longer occur In our version, after read_jpeg I get a 3D image GDL> help,b B BYTE = Array[3, 400, 400] My problem occurs only for 3-D images I have : GDL> a=dist(400) % Compiled module: DIST. GDL> image=a GDL> image=[[[image]],[[image]],[[image]]] GDL> write_jpeg,'image.jpg',image,true=3 GDL> read_jpeg,'image.jpg',c GDL> help,c C BYTE = Array[3, 400, 400] GDL> help,max(c) BYTE = 1 > OK, I just tested on the current Git version and I cannot reproduce your > problem > > ``` > GDL> a=dist(400) > % Compiled module: DIST. > GDL> write_jpeg,'image.jpg',a > % Compiled module: WRITE_JPEG. > GDL> read_jpeg,'image.jpg',b > GDL> help, a,b > A FLOAT = Array[400, 400] > B BYTE = Array[400, 400] > > GDL> !gdl > { > "RELEASE": "1.0.2-577-gcd1362cc", > "BUILD_DATE": "May 3 2024", > "EPOCH": 1714687200, > "GDL_USE_DSFMT": 1, > "GDL_USE_WX": 0, > "GDL_POSIX": 1 > } > > > ``` > > No changes in `read_jpeg.pro` and `write_jpeg.pro` since 3 years ... > Could you report the !gdl infos ? thanks > > Thank you very much! Heiner Billing > -- > Reply to this email directly or view it on GitHub: > https://github.com/gnudatalanguage/gdl/issues/1832#issuecomment-2120610086 > You are receiving this because you authored the thread. > > Message ID: ***@***.***>
GillesDuvert commented 6 months ago

Hello, I'm a bit confused. If I do your test (first part) I get:

GDL> a=dist(400)
% Compiled module: DIST.
GDL> write_jpeg,'image.jpg',a
% Compiled module: WRITE_JPEG.
GDL> read_jpeg,'image.jpg',b
GDL> help,max(b)
<Expression>    BYTE      =  255
GDL> help,b
B               BYTE      = Array[400, 400]
GDL> write_jpeg,'image.jpg',b,tr=1
% WRITE_JPEG: Array must have 3 dimensions: B
% Error occurred at: WRITE_JPEG         101 /usr/local/share/gnudatalanguage/lib/write_jpeg.pro
%                    $MAIN$          
% Execution halted at: $MAIN$          

This is normal, since:

IDL> a=dist(400)
% Compiled module: DIST.
IDL> write_jpeg,'image.jpg',a
% Loaded DLM: JPEG.
IDL> read_jpeg,'image.jpg',b
IDL> help,b
B               BYTE      = Array[400, 400]
alaingdl commented 6 months ago

Please move to GDL 1.0.5 !

To be inform when a new version appears, I suggest you register to the GDL announces mailing list

Concerning your problem, with GDL 1.0.5 I have :

GDL> help, max(c)
<Expression>    BYTE      =  255

OK, we don't change read_jpeg.pro and write_jpeg.pro but a lot of internal code was change !