How to create a lossless jpg using WIC in Delphi

我与影子孤独终老i 提交于 2019-12-02 01:32:33
David Heffernan

I've no experience of this, but here's my best suggestions based on reading the documentation that you have linked to.

First of all, I think you need to specify more of the members of PropBagOptions:

  • dwType needs to be set to PROPBAG2_TYPE_DATA.
  • vt needs to be set to VT_R4.

You also need to make sure that the variant really is VT_R4. That's a 4 byte real, in Delphi terms a variant of type varSingle.

V := VarAsType(1.0, varSingle);

I think that should get it done.

Putting it all together, it looks like this:

FillChar(PropBagOptions, SizeOf(PropBagOptions), 0);
PropBagOptions.pstrName := 'ImageQuality';
PropBagOptions.dwType := PROPBAG2_TYPE_DATA;
PropBagOptions.vt := VT_R4;
V := VarAsType(1.0, varSingle);
hr := PropBag.Write(1, @PropBagOptions, @V);

As regards whether or not JPEG quality 1.0 is lossless, it is not. That's a question already well covered here: Is JPEG lossless when quality is set to 100?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!