How to scale masked images??

Blitz3D Forums/Blitz3D Programming/How to scale masked images??

Danny(Posted 2008) [#1]
After using B3D for over 300 years, I can't believe this is giving me such a headache.... :D

I want to resize a Masked image without getting interpolation artifacts that basically destroys the mask.. HOW???

ResizeImage, ScaleImage, even FastExt's CopyRectStretch use some basic interpolation - fair enough. But I need 'nearest neighbor' to keep my mask intact (otherwise image 'quality' ain't such a big thing)..

I don't necesarily need a 'real-time' solution - it can be slow.
But I believe going through an image pixel-by-pixel is going to be 'too slow', especially since it could easily be a 2K or 4K image..

Anybody? I can't believe blitz doesn't provide for this (naive me)..

Thanks in advance,
Danny


Danny(Posted 2008) [#2]
The Silly thing is... I HAVE fixed this before... but lost my old code...
Tried a million things since then to no avail ...

I remember doing something 'not necesarily logical' but that did resize a masked image without getting the interpolation artifacts (using Blitz's ResizeImage cmd).
I believe it was because I created an image first, used CLS color to 'fill it' with the masking color, then copying the original on top, and THEN scaling that recently created image... not sure - but it was something 'silly' like that which actually fixed it, but haven't been able to reproduce it... :(


big10p(Posted 2008) [#3]
I assume you're talking about 2D since you mention Resize/ScaleImage. If so, maybe this is the command you're looking for:
http://www.blitzbasic.com/b3ddocs/command.php?name=TFormFilter&ref=2d_a-z


Danny(Posted 2008) [#4]
YES... silly me - sorry.... I just found it one minute ago - LOL

thanks. Please bury this post somewhere... deep!

-anonymous user.


Ross C(Posted 2008) [#5]
Never, it will always be top of the pile! BUMP!

Heh, it's amazing the things you forget though. I recently went back to code and forgot to put a renderworld in my main loop, then spent ages checking my graphics card driver and such. Stupid me...


Danny(Posted 2008) [#6]
shh.....t! LOL :))

Yes I've only used that TformFilter command ONCE before in my life, so far. ok, Twice now then...

One time I lost a day's work on my computer! I found out I actually forgot to turn the computer on in the first place! LOL

(ignore this)
:Danny