Image resizing quality vs basic photoshop resize

Rudolf: pic2 is missing. I will use here a different one…

Nice !

[quote=475535:@Rudolf Jackel]Hello,
in canvas, pictures can be drawn well if they were previously
converted into a pixmap shape[/quote]

This looks good on the canvas itself but does not have any improvement in image quality when using pixmapshape to draw into a new picture’s graphics.

[quote=475522:@Markus Rauch]no problem at xojo2019r31, there are no ugly hard edges.
did you overwrite AntiAlias in graphics card driver?
as i understood there is direct draw between at windows.
[/code][/quote]

I’m trying to get a new picture object that can be saved to disk. It looks fine when drawing onto a canvas (especially if retina is enabled) but anything drawing to an actual picture object has the jagged edges.

[quote=475517:@]Break after ppx.Graphics.DrawPicture(p,0,0,newW,newH,0,0,p.Width,p.Height) and check that ppx.Graphics.AntiAliasMode was set to HighQuality

Try the following, replace pic with your image, it works fine here on 2019r3.1 on W10 and Mojave, no jaggies

https://www.dropbox.com/s/px2le8bw0203t79/TestImageResizeJagged.xojo_binary_project?dl=0[/quote]

This looks fine on the canvas itself. But if you’re drawing to a picture object (to save to disk) it has the jagged edges.

Thanks Christian. These make a noticeable difference. Using these along with Emile Schwarz’s idea for a two-step resize seems to get 90% of the quality of the photoshop resize.

ahh, ok, i not test the file output and at apple device.
did you test DrawInto and then save the picture - if it looks better?

Var p As New Picture(Me.Width, Me.Height) Me.DrawInto(p.Graphics, 0, 0)

I’ve made an error the day I discovers that (I took an aready resized file instead of the full size one).

I’m not sure what you’re doing differently, but it looks fine to me on win and mac, here’s the converted image saved at 95% quality.

I’ve updated the code I posted to dropbox above to include the save shown here. This is processing the image you linked earlier.

hello Tom,
new examble - save and load and Window2

https://www.dropbox.com/s/4kt9zfamheh30i8/Testshapes-2.xojo_binary_project?dl=1

[quote=475728:@][/quote]
2019r3.1, and newest Catalina and Mojave (on two machines), and this is for a web app deployed to Xojo Cloud as well.

The update to your project works here now for the edges though it definitely wasn’t with the screenshot I posted above.

Either way I went with the PictureMagick + multi step resampling because it still looks noticeably better than the simple anti-aliased update.

Thank you for you help

Hello Tom
I have no spikes on the edges of my IMac 27 inch
the pixmap shapes are vector graphics
the quality is retained when saving
call up the saved image and check
see example

sorry - correct link

https://www.dropbox.com/s/uaqop1c6zcdls2w/test-angleandsize4.xojo_binary_project?dl=1

Tom, in this post https://forum.xojo.com/conversation/post/475513 you are looking at the picture in the Debugger - what’s to say the debugger isn’t mangling the picture when displaying it?

The only time I find the debugger doesn’t show me a correct representation of a picture, is when the Picture is part of an Image Set or an Array of bitmaps.

To identify when this happens, look for the ImageCount value. If the ImageCount is greater than 0, then when you click on “Contents”, I think the debugger only shows you the first image in the set (which is not necessarily the one you see in your app or output).

And as noted in ImageAt “…The individual pictures aren’t necessarily stored/returned in ascending scalefactor order. Do not rely on a particular order for the pictures…”

I only mention this because I came across a similar problem recently, when trying to debug why the correct scale sized picture wasn’t showing when I expected it to. In my case, Picture.BestRepresentation fixed my issue.