Dear Forum,
why does this not work?:
im.read(width, height, "RGB", CharPixel, im_rgb);
im.magick("JPEG");
im.quality(75);
im.defineValue("JPEG", "sampling-factor", "1x1,1x1,1x1");
im.write(varMap["of"].as<string>());
J. Barth
(again:) Magick++: how to "-sampling-factor XxY"
-
- Posts: 1
- Joined: 2012-09-17T04:38:17-07:00
- Authentication code: 67789
Re: (again:) Magick++: how to "-sampling-factor XxY"
There seems to be a bug in coders/jpeg.c. At line 2300jbarth_ubhd wrote:Dear Forum,
why does this not work?:
im.read(width, height, "RGB", CharPixel, im_rgb);
im.magick("JPEG");
im.quality(75);
im.defineValue("JPEG", "sampling-factor", "1x1,1x1,1x1");
im.write(varMap["of"].as<string>());
J. Barth
Code: Select all
value=GetImageProperty(image,"jpeg:sampling-factor");
Code: Select all
value=GetImageOption(image_info,"jpeg:sampling-factor");
if (value == (char *) NULL)
value=GetImageProperty(image,"jpeg:sampling-factor");
commandline input and also image data inherited from the
input image. With this change it works from the commandline
Code: Select all
convert logo: -define jpeg:sampling-factor="1x1,1x1,1x1" logo.jpg
convert logo.jpg logo2.jpg
I assume that "im.defineValue" works the same as "-define" on the commandline.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: (again:) Magick++: how to "-sampling-factor XxY"
-define sets an artifact, which is what is looked up by various coders and operators as needed.glennrp wrote: We have to check both Options and Properties so we handle
commandline input and also image data inherited from the
input image. With this change it works from the commandlinelogo.jpg and logo2.jpg both have the desired sampling-factors.Code: Select all
convert logo: -define jpeg:sampling-factor="1x1,1x1,1x1" logo.jpg convert logo.jpg logo2.jpg
I assume that "im.defineValue" works the same as "-define" on the commandline.
in IMv7 the properity (or escape) lookup will look for "attributes" (non-string per-image values, like width), "properties" (saved image meta-data), "artefacts" (non-saved per-image settings), and options (global user settings). In IMv6 "options" are coped (repeatly) into "artefacts", IMv7 have a link to it.
Note: Artefact lookup IMv7 also does a global "option" lookup, following the link back to the containing "wand" that holds image sequences.
Many API's do not have a 'wand' of global "options", so you need to set artifacts, on every image directly.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/