Bug 567887 - [GTK] ImageLoader failed to save image when bytesPerLines is not multiple of image's width
Summary: [GTK] ImageLoader failed to save image when bytesPerLines is not multiple of ...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.24   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-14 14:31 EDT by Arnaud de Muyser CLA
Modified: 2023-12-25 13:02 EST (History)
0 users

See Also:


Attachments
screenshot of snipet displaying loaded image, same image saved & reloaded (644.27 KB, image/png)
2020-10-14 14:31 EDT, Arnaud de Muyser CLA
no flags Details
original picture (846.36 KB, image/png)
2020-10-14 14:33 EDT, Arnaud de Muyser CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arnaud de Muyser CLA 2020-10-14 14:31:53 EDT
Created attachment 284454 [details]
screenshot of snipet displaying loaded image, same image saved & reloaded

Environment:
Ubuntu 20.04.1 LTS (focal)
eclipse: 2020_09
java: openjdk version "14.0.1" 2020-04-14
(also having issue with java-8-openjdk-amd64)
swt: org.eclipse.swt_3.115.0.v20200831-1002.jar
     org.eclipse.swt.gtk.linux.x86_64_3.115.0.v20200831-1002.jar


I can load  colored images using ImageLoader.load() and display image data correctly, painting image data's on a canvas.

When I save this image data (using JPEG or PNG format), image in file appears as black & white with pixel shift at each line.

This occurs when image data's bytesPerLines = width * (depth/8) + N  with N >= 1
(often 2).  (note that ImageData.data.length = bytesPerLines * height)

Original file can be loaded & correctly displayed using gimp, system' picture viewer, pngcheck report:
OK: Andorre la Viella, série 5.png (786x560, 24-bit RGB, non-interlaced, 34.4%).

on saved PNG file, pngcheck command reports:
OK: Andorre la Viella, série 5.png (786x560, 32-bit RGB+alpha, non-interlaced, 41.1%).

on saved jpeg, file commands reports:
ndorre la Viella, série 5.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 786x560, components 3
Comment 1 Arnaud de Muyser CLA 2020-10-14 14:33:57 EDT
Created attachment 284455 [details]
original picture
Comment 2 Arnaud de Muyser CLA 2023-12-25 13:02:07 EST
Reproduced using Eclipse 4.26.0
using plugins:
org.eclipse.swt_3.122.0.v20221123-2302.jar
org.eclipse.swt.gtk.linux.x86_64_3.122.0.v20221123-2302.jar