> Am 05.01.2018 um 14:56 schrieb Julia Truchsess <[email protected]>:
>
> I want to scale a PNG with good smoothing (e.g. Cubic or Mitchell algorithm)
> while retaining transparency/alpha. Simply redrawing into a graphics object
> at a new size per your example results in a poor quality image. I used
> PictureMBS because it’s the first class I found that offers smoothing.
>
Ihis seems to work here:
dim f as FolderItem = GetFolderItem("test.png")
dim p as Picture = Picture.Open(f)
if p.Type <> Picture.Types.MutableBitmap then
// make a copy, so we get a bitmap picture
dim t as new Picture(p.Width, p.Height)
t.Graphics.DrawPicture p, 0, 0, p.Width, p.Height, 0, 0, p.Width, p.Height
p = t
end if
dim destWidth as integer = p.width*2
dim destHeight as integer = p.Height*2
dim o as new Picture(destWidth, destHeight)
dim pi as new PictureMBS(p, true)
dim po as new PictureMBS(o, true)
dim r as Boolean = po.Scale(pi, nil, pi.ScaleCubic, destWidth, destHeight)
f = SpecialFolder.Desktop.Child("output.png")
o.Save(f, o.SaveAsPNG)
Can you try?
Sincerely
Christian
--
Read our blog about news on our plugins:
http://www.mbsplugins.de/
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info