Blitz is screwing with jpegs

BlitzPlus Forums/BlitzPlus Programming/Blitz is screwing with jpegs

Eikon(Posted 2004) [#1]
I am in the process of writing a screen saver and the image quality is of the utmost importance. I would use PNG but size is also a major factor. When comparing a JPEG from outside of Blitz, and then inside, i've noticed something very strange.

Take these two images:


The former is how it appears in any image viewer i've tested, the latter is from a Blitz+ window. Both my desktop and the graphics mode were set to 32bit.

I don't usually use jpgs in blitz so maybe i've missed something basic, but why is it degrading the image?


Beaker(Posted 2004) [#2]
And the difference is? What does the degrading do? Can you zoom in to show some detail?

The 2nd one looks less blurred, maybe?

Are you resizing the image at all in b+ ?


soja(Posted 2004) [#3]
Check your canvas dimensions. The right picture is slightly bigger than the left one. Whenever you resize JPGs, you will introduce artifacts.


Eikon(Posted 2004) [#4]
No canvas, just a Graphics window.

The pics were taken from screen grabs so the dimensions aren't the same, but its the same image for sure. I cut out a tiny portion of the larger image, a section which showed the most distortion.

@Beaker: Look at the face and you can see where its a lot more blocky. I saved as png so that what you see is exactly what im getting.
Graphics 800, 600, 32, 2
SetBuffer BackBuffer()

Img = LoadImage("gfx/11.jpg")

While Not KeyDown(1)

DrawBlock Img, 0, 0

Flip: Cls
Wend: End
Heres the images at 2x to magnify the differences.


Just tested some more and it looks like every version of Blitz is modifying it in the same way. Full screen also makes no difference. If someone would be kind enough to load a large jpeg on their side and scour it, you may find the same problem as me.


Beaker(Posted 2004) [#5]
It looks like the Blitz one isn't filtering or something. It does look like the one on the left is being blur filtered or something. Does the JPEG format contain a blur option? I know you can choose the blur amount on export from photoshop.


Eikon(Posted 2004) [#6]
I save with Irfanview and these are the settings I use:


Just strange that everything besides Blitz shows the image fine. VB, MSPaint, etc. Guess i'll have to figure out something else.


Kanati(Posted 2004) [#7]
load the picture into another viewer... Could be blitz is the one showing it "correctly" and your viewer is smoothing out the artifacting a bit.


Eikon(Posted 2004) [#8]
@Kanati: Its the other way around. Every language, viewer, etc. I have loaded it in displays it as on the left. Blitz is the odd man out.

Programs that i've tried:
MSPaint
Irfanview
Adobe Photoshop 7
Visual Basic Picture and Image box controls
Windows Picture and Fax Viewer
FireFox 0.9
IE 6
Mozilla 1.7


cyberseth(Posted 2004) [#9]
The one on the right actually has more head room on the top. The picture is not being stretched, nor is it being copied, it is as if Blitz is showing part of the picture that normal graphics packages aren't supposed to be showing. Perhaps the JPEG file itself is corrupt, something to do with the layout of the file and the dimensions specified in the file header. It could be that normal graphics deal with the problem one way, but Blitz's image-loading system deals with it another way.

Whatever the reason, Blitz is actually showing MORE of the picture than your graphics packages are. The extra section at the top proves it wasn't resized, and the gradient of the light in the top-right shows that it wasn't merely copied to increase the size, it's simply showing more of the picture.


Eikon(Posted 2004) [#10]
Thx for the input CS but you missed a crucial piece of info:

Eikon:
The pics were taken from screen grabs so the dimensions aren't the same, but its the same image for sure. I cut out a tiny portion of the larger image, a section which showed the most distortion.


Heres the image if anyone wants to try it out. I resize it to something around 640x480, resave as jpg, and load it in Blitz to see the problem.


DJWoodgate(Posted 2004) [#11]
You have good eyesight. I would not have noticed. But when I examine the two using magnifier the blitz one is clearly more blocky. So maybe there is a slight problem with the jpg loader blitz uses or maybe it just does not do any fancy post processing.


Russell(Posted 2004) [#12]
Blitz uses the 'FreeImage' library, doesn't it? Perhaps that's why it's free ;)

Seriously, though, I wonder if every function that displays jpegs in every program uses the same code, or do they follow a standardized guideline that results in slight differences between different programs?

Just a thought.

Russell