Resize images on OS X

Yes, in 2016 - as we already know from a different conversation - Xojo is wrong to really bad with Graphics…

I shared below the Image file and how it is resized withing Xojo.

The original image was scanned, saved as jpg. I loaded it, remove the white background, change some colors, resize it and save it using GIMP (copy it before closing the file in GIMP). Drats: saved as jpg, there is no alpha channel, but the result is as bad as with the alpha channel.

I’ve done the above because my “original” (png) file looked as bad as you can see (far) below.

I add the CopyPaste feature to that project for the occasion (in case it was the Open feature that was involved).

The original project was created using Xojo 2015r1. I open it using Xojo 2016r2 - in case a change may have been added since last year - and checked with this version too (faster than reading a bunch of release notes).

At last, I used the bucklet to fill the colors “in case it was the original scan colors” that is in cause and I waste my time (same results).

Before posting this text, I checked Graphics.UseOldRenderer but this is deprecated.

I even changed the Integer variables used to resize the image to Double (yes, this matters in the way the image size is done at DrawPicture time *)

This happens on 2 images on a 32 images process (30 nice icons were generated).

Sorry Sir, I will wait a bit more version(s) to upgrade Xojo (if I will do it).

Am I angry ? Yes ! And I am a customer (not a bird).

Note: I am hungry too, but this is because it is 8 PM and I do not eat anything since lunch.

BTW and before I forget:

OS X 10.11.6 (installed from App Store this afternoon) Checked with Xojo 2015r1 AND 2016r2.

Under some original sizes / target resized pictures, a difference of 1 (or more ?) pixel(s) can occured when Integers are used.

Original image:

Image created by the project:

Open the window screen shot to see how bad the resizes are. It is a Retina screen shot that looks far better above.

This was discussed at length with diverse workarounds at https://forum.xojo.com/9403-scale-quality-of-canvas-control/0

in memory of this old conversation ( 6 different resize methods )

https://forum.xojo.com/9403-scale-quality-of-canvas-control/p5#p195365

No bug removal if there are workarounds ?
:wink:

Thank you Axel for the link (and reminder).

None of them quality is near what Preview gaves me.

Try calling this method before drawing.

[code]Sub setHighInterpolation(g As Graphics)

declare sub CGContextSetInterpolationQuality lib “CoreGraphics” (cntxt As integer, q As integer)

CGContextSetInterpolationQuality( g.Handle(Graphics.HandleTypeCGContextRef), 4 )

End Sub
[/code]

Pass it the graphics you are going to draw to. So in a Paint event it’d be

setHighInterpolation(g) g.DrawPicture pic, x, y, w, h, x2, y2, w2, h2

If drawing into a picture it’d be

setHighInterpolation( finalPic.Graphics ) finalPic.Graphics.DrawPicture pic, x, y, w, h, x2, y2, w2, h2

Thanks Will, I will check that.