Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Improve image stretch algorithms under Windows? (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] Which QuickTime Components Needed?
Next thread: [MBS] HTMLRendering


Re: [MBS] MIDI Destinations and External Devices   -   Ron Benditt
  [MBS] Improve image stretch algorithms under Windows?   -   Mike D.
   Re: [MBS] Improve image stretch algorithms under Windows?   -   Christian Schmitz
   Re: [MBS] Improve image stretch algorithms under Windows?   -   Mike D.
    Re: [MBS] Improve image stretch algorithms under Windows?   -   Christian Schmitz

[MBS] Improve image stretch algorithms under Windows?
Date: 14.01.03 18:18 (Tue, 14 Jan 2003 09:18:23 -0800)
From: Mike D.
Under windows, if you resize an image, the resized version looks
quite poor (jaggy). Under OSX it looks beautiful, nearly as good as
if you had used PhotoShop. My understanding is that the resize
algorithms in windows are just not that good.

Is there any way to use QuickTime to resize the image to get a more
consistent look across operating systems? Speed is not the primary
issue, so I'm willing to export and re-import the image to a file if
necessary as one of the steps..

Thanks!

Re: [MBS] Improve image stretch algorithms under Windows?
Date: 14.01.03 19:18 (Tue, 14 Jan 2003 19:18:10 +0100)
From: Christian Schmitz
> Is there any way to use QuickTime to resize the image to get a more
> consistent look across operating systems?

Sure. Export and use the Importer class in the plugin.

BVut within 30 minutes, I got this nice code working:

Function resize(p as picture,dw as integer,dh as integer,
errorcorrection as boolean) As picture

// Picture Resize by Christian Schmitz, 14. Jan 2003, <email address removed>

dim n as Picture
dim pr,nr as RGBSurface
dim nx,ny as integer
dim pw,ph as integer
dim nw,nh as integer
dim nww,nhh as integer
dim r,g,b as integer
dim c as integer
dim xx,yy as Double
dim co as color
dim x,y as integer
dim fx,fy as Double
dim cfx,cfy as Double
dim x1,y1 as integer
dim x2,y2 as integer
dim x3,y3 as integer
dim x4,y4 as integer

dim f1 as Double
dim f2 as Double
dim f3 as Double
dim f4 as Double

n=NewPicture(dw,dh,32)

pw=p.Width-1
ph=p.Height-1
nw=n.Width-1
nh=n.Height-1

pr=p.RGBSurface
nr=n.RGBSurface

nww=nw
nhh=nh

if errorcorrection then

for xto nw
for yto nh
xx=x*pw/nw
yy=y*ph/nh

x1ðoor(xx)
y1ðoor(yy)
x2=x1+1
y2=y1

x3=x1
y3=y1+1
x4=x1+1
y4=y1+1

fx=xx-x1
fy=yy-y1
cfxfx
cfyfy

f4=(fx*fy)
f3=(cfx*fy)
f2=(fx*cfy)
f1=(cfx*cfy)

co=pr.Pixel(x1,y1)
rÀ.red*f1
gÀ.green*f1
bÀ.blue*f1

co=pr.Pixel(x2,y2)
r=r+co.red*f2
g=g+co.green*f2
b°co.blue*f2

co=pr.Pixel(x3,y3)
r=r+co.red*f3
g=g+co.green*f3
b°co.blue*f3

co=pr.Pixel(x4,y4)
r=r+co.red*f4
g=g+co.green*f4
b°co.blue*f4

nr.Pixel(x,y)=rgb(r,g,b)

next
next
else
for xto nw
for yto nh
xx=x*pw/nw
yy=y*ph/nh

nr.Pixel(x,y)=pr.Pixel(xx,yy)

next
next
end if

Return n
End Function

if everyone thinks it makes nice pictures, I can put in the plugin to
make it over 100% faster.

Mfg
Christian

--
Three

Re: [MBS] Improve image stretch algorithms under Windows?
Date: 16.01.03 18:44 (Thu, 16 Jan 2003 09:44:27 -0800)
From: Mike D.
>Subject: Re: [MBS] Improve image stretch algorithms under Windows?
>From: <email address removed> (Christian Schmitz)
>Date: Tue, 14 Jan 2003 19:18:10 +0100
>Reply-To: <email address removed>
>> Is there any way to use QuickTime to resize the image to get a more
>> consistent look across operating systems?
>
>Sure. Export and use the Importer class in the plugin.
>
>BVut within 30 minutes, I got this nice code working:
>
>Function resize(p as picture,dw as integer,dh as integer,
>errorcorrection as boolean) As picture

I assume this is a bicubic(?) resize algorithm? My main goal is
quality, so if the export/import works better then I'll use it, but
if not, then i'd love to see this coded in fast C in your plugin.

Re: [MBS] Improve image stretch algorithms under Windows?
Date: 16.01.03 22:44 (Thu, 16 Jan 2003 22:44:17 +0100)
From: Christian Schmitz
> I assume this is a bicubic(?) resize algorithm? My main goal is
> quality, so if the export/import works better then I'll use it, but
> if not, then i'd love to see this coded in fast C in your plugin.

Why don't you just set up an example project?

Resize using both (even if the example app will be very slow) and make a
picture comparing e.g. in Graphicsconverter.

Mfg
Christian