Resize images: gocomics uses Xojo ?

When I saw the image there:

That’s what I think !

They used a Xojo application to resize their image :frowning:

(or another company does not had time to improve the way they resize images too).

The base image is wrong:

[I take only the image displayed (low size) in the front page)
Compare to:

Alley Oop, max size:

Maybe YOU create sloppy images with Xojo, but that doesn’t mean everyone does or that Xojo is incapable of creating quality output. Your post is just offensive.

Only if you have a good and working solution, otherwise, you are waiting for the resize improve.
Just like any bug.

I’ve seen a ton of resize image apps in my life; made with a variety of tools (I’ve seen plenty of Objective-C based apps suck) on a variety of platforms. It comes down to knowing how to use the right tools and APIs to resize images in the first place.

For instance in OS X, there’s 5 ways with API that I can think of right now.

I am not surprised: gocomics updated the image and now it is as nice as usual (since 1911 !).

The only issue I’ve had with gocomics is the annoying, really annoying, pop-in, pop-up, and all the other adverts

pop-in, pop-up ?

adverts: I suppose you’re talking about the advertisings in the web page. I do not care about this one, I only took my large file (click, display the image, save as 900 pixels wide or more [1500 pixels max]).

@Emile: sometimes you are rather strange. Don’t whine - make it better. Here is a bilinear interpolation (translated from Java). Bicubic didn’t make much of a difference and the algorithm is much more compliated:

[quote]Private Function BilinearInterpolation(OriginalPicture as Picture, newWidth as Integer, newHeight as Integer, constrainProportion as Boolean) As Picture

dim w as Integer = OriginalPicture.Width
dim h as Integer = OriginalPicture.Height
dim x_ratio as Double = (w - 1)/newWidth
dim y_ratio as Double = (h - 1)/newHeight
if constrainProportion then
if x_ratio >= y_ratio then
newHeight = h/x_ratio
newWidth = w/y_ratio
end if
x_ratio = max(x_ratio, y_ratio)
y_ratio = max(x_ratio, y_ratio)
end if

dim oldSurf as RGBSurface = OriginalPicture.RGBSurface
dim oldMaskSurf as RGBSurface = OriginalPicture.Mask.RGBSurface
dim InterpolatedPicture as new Picture(newWidth, newHeight, 32)
dim InterpolatedSurf as RGBSurface = InterpolatedPicture.RGBSurface
dim InterpolatedMaskSurf as RGBSurface = InterpolatedPicture.mask.RGBSurface

dim x, y, alphaValue as Integer
dim x_diff, y_diff, blue, red, green, gray as Double
dim a, b, c, d as Color

for i as Integer = 0 to (newHeight - 1)
for j as Integer = 0 to (newWidth - 1)
x = x_ratio * j
y = y_ratio * i
x_diff = (x_ratio * j) -x
y_diff = (y_ratio * i) - y

  'calculations for red, green and blue
  a = oldSurf.Pixel(x, y)
  b = oldSurf.Pixel(x + 1, y)
  c = oldSurf.Pixel(x, y + 1)
  d = oldSurf.Pixel(x + 1, y + 1)
  blue = (a.Blue * (1 - x_diff) * (1 - y_diff)) + (b.Blue * x_diff * (1 - y_diff)) + (c.Blue * y_diff * (1 - x_diff)) + (d.Blue * x_diff * y_diff)
  green =  ( * (1 - x_diff) * (1 - y_diff)) + ( * x_diff * (1 - y_diff)) + ( * y_diff * (1 - x_diff)) + ( * x_diff * y_diff)
  red =  ( * (1 - x_diff) * (1 - y_diff)) + ( * x_diff * (1 - y_diff)) + ( * y_diff * (1 - x_diff)) + ( * x_diff * y_diff)
  InterpolatedSurf.Pixel(j, i) = RGB(red, green, blue)
  'now the mask
  a = oldMaskSurf.Pixel(x, y)
  b = oldMaskSurf.Pixel(x + 1, y)
  c = oldMaskSurf.Pixel(x, y + 1)
  d = oldMaskSurf.Pixel(x + 1, y + 1)
  gray = (a.Blue * (1 - x_diff) * (1 - y_diff)) + (b.Blue * x_diff * (1 - y_diff)) + (c.Blue * y_diff * (1 - x_diff)) + (d.Blue * x_diff * y_diff)
  InterpolatedMaskSurf.Pixel(j, i) = RGB(gray, gray, gray)


Return InterpolatedPicture
End Function

I think his point is that for a RAD product, needing to do declares, buy plug-ins or manipulate pixels in code to do such common need well, is unexpected and that the built in xojo resizing (using DrawPicture with all the parameters) should be better.

That said, it’s not been a significant issue for me yet.

  • Karen

RAD has never meant “it should include everything I’ll ever need”

Oh… , i thought it meant : “Ready for All Desires” :wink:

True but IMO In general it should include most common needs, and IMO picture resizing does fall into that category.

I do understand however, that with time what is perceived as a basic need (and reasonable quality) does increase… With time the bar keeps getting raised and everyone (developers and end users) keeps expecting more. That’s life in the tech industry…

  • Karen

And for anyone making games it should include …
For database based apps it should include …

Pick the list you’re interested in and I’m sure there’s something missing
FWIW - VB was that way too
I used it for years in one job I had and we just bought the add ons we needed & moved on

Thanks all for your answers.

The problem is also… I am seeking for a job and i try to create things to demonstrate a knowledge (low). This particular trouble does not appears everytime, but I never was able to determine how to avoid it.

We all know that bugs in presentations appears when you do the presentation, especially at that moment.

Now if the money was not a problem, I do not used REALbasic at first, so many years ago :wink:

When I do not fall into very strange things (absolute incredible things) …

or most basic things.

At last, if I know how to do, I would not ask here, but only give answers. And usually, I do my homework before coming here: make an intensive search, clears cache, quit, wait, reboot and fire Xojo alone…

I even pushed the TV displaying in the Windows 10 laptop connected to my external monitor (and so I just use the OS X laptop monitor to develop). I stopped to add extensions and fancy applications around 20 years ago…

Usually, I tell that whine, ranting, crying are a waste of time. But what can I do each time I fall into a closed door because of something so basic ? If that so basic something comes in a yound product, we can flag it (Feedback for example) and wait for a change in the following months, but here I am talking about a software that is nearly 20 y/o.

It’s usually a problem of not starting with a high-quality image. But I would encourage you to post an example that renders poorly and let the community help resolve it.

Did you try the algorithm that I posted?

I get a nil object exception in this line, trying to reduce a picture dragged into the project on Mac :

dim oldMaskSurf as RGBSurface = OriginalPicture.Mask.RGBSurface

Not yet. I will try it in the afternoon.

Thank you.

@Michel Bujardet: which version do you use? The code is tested up to 2016r1. Doesn’t the Retina switch make several things read-only?

Hi Tim,

usually, Preview (on OS X) result is far better.

There already be one (or more) discussions on this subject and example images have been shared and also alternate code.

I recall that I noticed if the original file width or height value is odd, result may have troubles (I will not get the exact value I ask, if my memory is correct ~).
I also recall that using Doubles in DrawPicture gave “better” results than using Integers (if you compute a resize value / compute one of the value(s) used as DrawPicture parameters.

I do not have the latest “buggy” image I used lately, but the starting image was large enough to be resized with good results to the needed size.

Ha ! I found the image, it is here:

BTW: I nearly forgot… this is not for a one time use *, but each time it is a major part of the project.

If this was the case, I fired Feedback and forgot about it.