Are YCbCr 422/420 supported in ImageMagick?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
prashant
Posts: 3
Joined: 2018-07-17T01:12:41-07:00
Authentication code: 1152

Are YCbCr 422/420 supported in ImageMagick?

Post by prashant » 2018-07-17T01:25:27-07:00

Hi,

I am using "convert" command to convert JPG/PNG files to YCbCr 444 using the below command:
convert index.jpg -colorspace YCbCr index_ycbcr.dpx
I have noticed that DPX descriptor is 102, which confirms 444 mode.
Then I tried to generate YCbCr 422 DPX file with the below command:
convert index.jpg -colorspace YCbCr -sampling-factor 4:2:2 index_ycbcr.dpx
But I have noticed that DPX descriptor is 102 (expected value was 100).

Can someone please help me out?
I have following queries:
1. I need to know if DPX YCbCr 422 file can be generated? If yes, please let me know the command. If no, How to change descriptor value (-set dpx:descriptor 100 did not work for me)

2. Will the below command generate YCBCr output file? (I have added -type TrueColor)
convert index.jpg -colorspace YCbCr -type TrueColor index_ycbcr.dpx


Thanks,
Prashant

prashant
Posts: 3
Joined: 2018-07-17T01:12:41-07:00
Authentication code: 1152

Re: Are YCbCr 422/420 supported in ImageMagick?

Post by prashant » 2018-07-19T21:59:26-07:00

Somebody please help.

User avatar
fmw42
Posts: 25408
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Are YCbCr 422/420 supported in ImageMagick?

Post by fmw42 » 2018-07-19T22:41:40-07:00

I do not know much about this, but please provide your ImageMagick version and platform for those who might be able to help you.

Looking at http://www.imagemagick.org/script/formats.php for DPX, it seems to say to use -set for a number of setting. You might try that in place of -sampling-factor, i.e. -set sampling-factor 4:2:2

I tried both and EXIFTOOL always reports:

800 ComponentsConfiguration : 102

So one of the developers may have to answer this.

prashant
Posts: 3
Joined: 2018-07-17T01:12:41-07:00
Authentication code: 1152

Re: Are YCbCr 422/420 supported in ImageMagick?

Post by prashant » 2018-07-20T01:21:32-07:00

Hi Fred,

Thanks for responding.

I'm using the below version of IM in Linux environment:
imagemagick-6.9.3

I had tried -sampling-factor 2x1 & -sampling-factor 4:2:2 but neither worked. As you said it is always 102 (descriptor @800). I see the source code (IM 6, convert.c) has no implementation for 100 and 104. So I'm starting to believe that 422,420 are not yet implemented.

I'm working with my team on installing IM 7. I will give a try with that also.

Also, any idea on how to catch the attention of any of the developer?

Thanks,
Prashant

User avatar
fmw42
Posts: 25408
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Are YCbCr 422/420 supported in ImageMagick?

Post by fmw42 » 2018-07-20T08:58:07-07:00

I moved your post here so that they might find it better.

B4adle7
Posts: 11
Joined: 2018-06-10T10:25:40-07:00
Authentication code: 1152

Re: Are YCbCr 422/420 supported in ImageMagick?

Post by B4adle7 » 2018-12-12T10:24:26-07:00

Hi prashant.
Have you found your solution? May be a couple months out, but am pretty familiar with working with dealing with the 420, 422, 444 formatting issues.

Just a start in case it comes in useful, is trying to understand what issue you are running into. Also trying to understand the perspective.
Usually the point of dealing with the formatting you are speaking of happens at the time of compiling a video using FFMoeg.
(Granted FFMpeg comes packaged with Imagemagick).
This may be an instance of the wrong tool for the job? With Imagemagick you want to handle the color transforms and colorspace handling for your images. Once you have them in the desired colorspace, then you compile them into your movie file with FFMpeg specifying the pixel format as such:
-pix_fmt yuv422p10le
-pix_fmt yuva422p10le
-pix_fmt yuv444p10le
-pix_fmt yuva444p10le

No, I do not think Imagemagick supports the video formats YCbCr 422/420. I believe that is video formats that you would want to use FFMpeg for.

Post Reply