MBS Picture Plugin dithering in 64bit

I have a need to quantize images.
For some time, Ive been using the MBS implementation of ImageMagick or GraphicsMagick (not sure why there are two…)
However, when they reduce image color depth, there are only two methods of dithering available.
TransformbetterDithering which is a form of Floyd Steinberg, and TransformFastDithering (which is a bit of a mess and looks like Windows 3.1).

There are maybe 11 or so dithering algorithms, for example ‘Stucki’, and I would like to be able to offer a bigger variety than ‘none, a bit like FS, or really poor’

Does anyone know of other quantization options that can improve or at least offer some variety?

Well, TransformbetterDithering and TransformFastDithering are things I wrote long ago to solve a problem we had with a client.

That’s not GraphicsMagick or ImageMagick!

LOL!

Isn’t it odd that a suite of functions like IM offers should omit this kind of thing?

Well, we do have those plugins. Two because GraphicsMagick comes with library inside and ImageMagick with library external.

Maybe those work better for you?

Thanks Christian… no, thats the point… neither of the libraries gives a choice of dither options,
Its ‘dither or not’, and your functions were the only ones I could get to do anything useful.

TransformbetterDithering looks good to my eyes, but I want to offer choices, and GM offers none as far as I can see…

I have this page, and a sinking feeling… :slight_smile:
http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/

I have found that in 64 bit builds, there is a problem using the TransformBetterDithering function.
I had thought the problem was image related and Xojo, but it lies in this function.

The issue occurs when the image is not a width that divides by 4
I get a strip of black down the left and a white strip somewhere in the middle.

Very stripped down code:

p = <the image> m = pc.TransformbetterDithering(p) dim r as picture r = pc.Transform(m,p.width,p.height)

This is what happens using normal ‘Transform’

and this is after TransformBetterDithering

MBS Picture plugin version 15.4
MAC Sierra

Well, you can always add a bit of white space on the side to make it a multiply of 4 and than later remove it.

Also you can try newer plugins to check if this got fixed in-between.

I was rather hoping you might remember if you fixed it or not.

No problem: I have replaced the code:

[code]  dim img as new GMImageMBS(p)
  img.quantizeColors = nColors  //max colors
  img.quantizeDither = true  //do the dither
  img.quantize
  img.type = img.TrueColorType
  dim r as picture
  r = img.CopyPicture
  m = pc.Transform(r)[/code]