You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (Jira)" <ji...@apache.org> on 2022/08/14 04:17:00 UTC
[jira] [Commented] (IMAGING-272) org.apache.commons.imaging.Imaging#getImageInfo(java.io.File) of RGB image returns YCbCr color type type
[ https://issues.apache.org/jira/browse/IMAGING-272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17579315#comment-17579315 ]
Bruno P. Kinoshita commented on IMAGING-272:
--------------------------------------------
Using `exiftool` to HTML-dump the image contents, gives the following:
* JPEG header
* APP0 JFIF segment
* JPEG DQT
* JPEG SOF0
* JPEG DHT x 4
* JPEG Image Data
* JPEG EOI
{noformat}
kinow@ranma:~/Downloads$ exiftool -v train.jpg
ExifToolVersion = 11.88
FileName = train.jpg
Directory = .
FileSize = 70832
FileModifyDate = 1660442072
FileAccessDate = 1660442106
FileInodeChangeDate = 1660442072
FilePermissions = 33204
FileType = JPEG
FileTypeExtension = JPG
MIMEType = image/jpeg
JPEG APP0 (14 bytes):
+ [BinaryData directory, 9 bytes]
| JFIFVersion = 1 1
| ResolutionUnit = 0
| XResolution = 1
| YResolution = 1
| ThumbnailWidth = 0
| ThumbnailHeight = 0
JPEG DQT (130 bytes):
JPEG SOF0 (15 bytes):
ImageWidth = 1280
ImageHeight = 720
EncodingProcess = 0
BitsPerSample = 8
ColorComponents = 3
YCbCrSubSampling = 2 2
JPEG DHT (27 bytes):
JPEG DHT (85 bytes):
JPEG DHT (26 bytes):
JPEG DHT (68 bytes):
JPEG SOS
kinow@ranma:~/Downloads$ exiftool train.jpg
ExifTool Version Number : 11.88
File Name : train.jpg
Directory : .
File Size : 69 kB
File Modification Date/Time : 2022:08:14 13:54:32+12:00
File Access Date/Time : 2022:08:14 13:55:06+12:00
File Inode Change Date/Time : 2022:08:14 13:54:32+12:00
File Permissions : rw-rw-r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.01
Resolution Unit : None
X Resolution : 1
Y Resolution : 1
Image Width : 1280
Image Height : 720
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Image Size : 1280x720
Megapixels : 0.922{noformat}
No Adobe segments, no JFIF APP2 segment. The current Java code appears to follow what's described in Java's javadocs for imageio, https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/imageio/metadata/doc-files/jpeg_metadata.html:
!image-2022-08-14-16-10-16-013.png!
ImageMagick displays the color type as sRGB:
!image-2022-08-14-16-11-00-398.png|width=550,height=333!
GIMP shows RGB:
!image-2022-08-14-16-11-55-741.png|width=574,height=408!
identify shows sRGB
!image-2022-08-14-16-13-37-767.png|width=612,height=385!
I think the JPEG standard pre-dates sRGB, and there were revisions of the standards with changes to how clients must handle the color types/spaces. Going to search for the latest spec to learn more and see if there's an answer on how the JPEG parser must handle the color type.
> org.apache.commons.imaging.Imaging#getImageInfo(java.io.File) of RGB image returns YCbCr color type type
> ---------------------------------------------------------------------------------------------------------
>
> Key: IMAGING-272
> URL: https://issues.apache.org/jira/browse/IMAGING-272
> Project: Commons Imaging
> Issue Type: Bug
> Affects Versions: 1.0-alpha2
> Reporter: Marian Faydula
> Priority: Blocker
> Attachments: image-2022-08-14-16-10-16-013.png, image-2022-08-14-16-11-00-398.png, image-2022-08-14-16-11-55-741.png, image-2022-08-14-16-13-37-767.png, image_2020_11_23T15_59_24_681Z.png, screenshot-1.png, train.jpg
>
>
> When I call org.apache.commons.imaging.Imaging#getImageInfo(java.io.File) method on attached train.jpg image ColorType is *YCbCr* but actually it is *RGB*
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)