Resizing image with subsampling?

BlitzMax Forums/BlitzMax Programming/Resizing image with subsampling?

Arowx(Posted 2009) [#1]
Hi there am I correct in saying that resizing a Pixmap, just reduces it's pixel count without any subsampling/averaging of pixel values.

If so would scaling and grabbing an image produce a smoother scaled image?

Regards


xlsior(Posted 2009) [#2]
Scaling & grabbing the image would be smooth, but you'd lose your alpha information... There are some snippets in the code archives that will help you maintain the alpha, though.


Arowx(Posted 2009) [#3]
Yes got that to work, but it is very slow on large images with large scale factors e.g.

1200x1200 to 5x5 = taking around 1 second to load/scale/draw and grab!

The trouble is I'm processing a lot of tiles (about 14000), that's the trouble when you grab raw data from NASA!

Would threading help speed this up, but the bottneck appears to be the scale and draw operations, I'll try opengl to see if it's faster!




Dreamora(Posted 2009) [#4]
You can not thread graphical operations.
You have a single thread that can access the 2D / 3D commands.


If you want good performance, use a few worker threads and use math to sample them using the pixmaps, without even going to the graphics level which won't offer you much additional power due to the time required to upload the 2048x2048 texture


Arowx(Posted 2009) [#5]
Well it has finished processing after about an hour and a half, I have another set of images to process but with far fewer images although larger they require less of a scale factor, if it looks really slow again I might just look into threading it!

Cheers


Arowx(Posted 2009) [#6]
Darn it DX7 fails when trying to create an image of 4800x6000 how dare it when I only need it scaled to 200x250 image!

Well I'm going to look into a way to get around this but if you have any ideas please drop a line!


ImaginaryHuman(Posted 2009) [#7]
maximum texture size is possibly only 4096x4096 on your card?

you'd have to split the pixmap into multiple pixmaps and then upload as separate images.


Arowx(Posted 2009) [#8]
Well it was a bit tricky but if you ensure the initial image is placed in a pixmap with a square ratio then you can use window on the pixmap to create individual 1024x1024 images that can then be scaled and drawn!

Phew that's one task done!