phpQuestioner Posted September 5, 2007 Share Posted September 5, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/ Share on other sites More sharing options...
uknowho008 Posted September 5, 2007 Share Posted September 5, 2007 you can make animated jpg's? Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-341848 Share on other sites More sharing options...
phpQuestioner Posted September 5, 2007 Author Share Posted September 5, 2007 ok - do you know where can i find an example of this? Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-341851 Share on other sites More sharing options...
Psycho Posted September 5, 2007 Share Posted September 5, 2007 There is no such thing as an animated JPG, created with PHP or otherwise. The reason I want it in JPG instead of GIF is to help preserve the quality of the image Um, jpg is a "lossy" compression method. Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-341852 Share on other sites More sharing options...
phpQuestioner Posted September 5, 2007 Author Share Posted September 5, 2007 ok - thanks for the answer JPG looks better then GIF (in comparison to between the two) Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-341853 Share on other sites More sharing options...
Psycho Posted September 5, 2007 Share Posted September 5, 2007 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). Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-342057 Share on other sites More sharing options...
d22552000 Posted September 5, 2007 Share Posted September 5, 2007 althoguh if you were really nautzie on getting jpgs to animate have an ifram with about 30 pages and start on page 1, meta refresh 1 to the next page and so on that would be hefty but its the only way to do what you want. Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-342065 Share on other sites More sharing options...
crazygol4 Posted September 5, 2007 Share Posted September 5, 2007 althoguh if you were really nautzie on getting jpgs to animate have an ifram with about 30 pages and start on page 1, meta refresh 1 to the next page and so on 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 Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-342095 Share on other sites More sharing options...
Psycho Posted September 5, 2007 Share Posted September 5, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-342379 Share on other sites More sharing options...
Barand Posted September 5, 2007 Share Posted September 5, 2007 If only the GD library supported animated gif Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-342449 Share on other sites More sharing options...
d22552000 Posted September 8, 2007 Share Posted September 8, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-344194 Share on other sites More sharing options...
Barand Posted September 8, 2007 Share Posted September 8, 2007 I searched php.net for png2jpg and found nothing. Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-344196 Share on other sites More sharing options...
d22552000 Posted September 8, 2007 Share Posted September 8, 2007 its an example application in bambalam php compiler. it has the source if you download: bambalam 1.31 (win32) (search google for it) Quote Link to comment https://forums.phpfreaks.com/topic/67999-possible-to-create-a-php-animated-jpg/#findComment-344366 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.