# Resize images on OS X

**URL:** <https://forum.xojo.com/t/resize-images-on-os-x/32537>\
**Category:** General\
**Created:** [July 19, 2016, 6:59pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537 "2016-07-19T18:59:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [July 19, 2016, 6:59pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/1 "2016-07-19T18:59:26Z")

</div>

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:  
 ![](https://www.mediafire.com/convkey/0599/u0ifj1aa4h9huvc6g.jpg)

Image created by the project:  
 ![](https://www.mediafire.com/convkey/146f/3mbrcf88evf8etu6g.jpg)

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [July 19, 2016, 7:12pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/2 "2016-07-19T19:12:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [July 19, 2016, 7:19pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/3 "2016-07-19T19:19:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [July 19, 2016, 7:19pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/4 "2016-07-19T19:19:49Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [July 30, 2016, 8:10am UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/5 "2016-07-30T08:10:01Z")

</div>

No bug removal if there are workarounds ?  
😉

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [July 31, 2016, 12:18pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/6 "2016-07-31T12:18:46Z")

</div>

Thank you Axel for the link (and reminder).

> [@277921:@Axel Schneider](#):
>
> in memory of this old conversation ( 6 different resize methods )

None of them quality is near what Preview gaves me.

---

<div class="post-metadata">

**Author:** ![Will\_Shank](https://forum.xojo.com/letter_avatar_proxy/v4/letter/w/f475e1/32.png) [@Will\_Shank](https://forum.xojo.com/u/Will_Shank)\
**Post date:** [July 31, 2016, 1:02pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/7 "2016-07-31T13:02:44Z")

</div>

> [@279986:@Emile Schwarz](#):
>
> 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`

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [July 31, 2016, 6:14pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/8 "2016-07-31T18:14:59Z")

</div>

Thanks Will, I will check that.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:24pm UTC](https://forum.xojo.com/t/resize-images-on-os-x/32537/9 "2020-10-29T18:24:04Z")

</div>


