Jump to content

Recommended Posts

Is it possible to create a PHP Animated JPG without any other type of PHP Libraries? The reason I want it in JPG instead of GIF is to help preserve the quality of the image. Any body know if this can be done; if so can you point me in the right direction of where I can learn more about it?

Link to comment
https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/
Share on other sites

JPG and GIF each have their benefits and drawbacks. JPG files are good for "full color" photographs because they support millions of colors. But, the compression that is used can lose some of the quality. Basically it works be determining that several pixels next to each other are close to the same color, so when the jpg is created it saves those pixels as the same color losing some of the nuance, but usually not noticable. Each time the images is saved there is new compression. So always work from an uncompressed original when possible. The amount of compression can be adjusted to very high (images look like crap) to none (images are very big). You should never use jpg for lineart or logo type images. The compression will be very noticable around the edges of colors.

 

GIFs on the other hand only support a pallet of 256 total colors. But, they are not lossy. Each pixel is saved as an exact color, not an approximation. This format is much better for logos and lineart. Plus, it supports transparency and multiple frames (animation).

althoguh if you were really nautzie on getting jpgs to animate have an ifram with about 30 pages and start on page 1, :D meta refresh 1 to the next page and so on :D

 

that would be hefty but its the only way to do what you want.

althoguh if you were really nautzie on getting jpgs to animate have an ifram with about 30 pages and start on page 1, :D meta refresh 1 to the next page and so on :D

 

that would be hefty but its the only way to do what you want.

 

LoL I was just thinking the same thing.  Who knows, it might do the trick for him if he was trying to emulate Pong for Atari.

 

-Mark

Well, a 1-second timframe between frames would be a very slow animation to say the least. But, for arguments sake it might make more sense to change the frames using javascript. You could then change the images much more rapidly.

 

However, after some more thought, I think using GIF for an animated image should be perfectly acceptable with regard to quality. Because the image is animated and the way the eye sees colors and shapes, any perceived loss of quality due to a gif format would be very little.

well, it does.

 

use png2jpg to convert the standard gd makes (create themand string their data to an array [1],[2] and so on) and then use png2jpg($gd[1],$gd[2]);

 

for some reason it outputs a gif code under $gid[0];  os just echo that, it was hilarious when I did that for my vb captcha on april fools.  the image would chang every half second or so, people were like WTF i cant loginzz!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.