Computing.Net > Forums > Digital Photo/Video > can jpg or jpeg be animated?

can jpg or jpeg be animated?

Reply to Message Icon

Original Message
Name: dunpealx4
Date: February 28, 2008 at 19:39:30 Pacific
Subject: can jpg or jpeg be animated?
OS: 12
CPU/Ram: 2
Model/Manufacturer: 3
Comment:

some website only accept jpeg as icon or avatar. but i wanna use animated icon. so i wonder if theres any animated jpg or jpeg pics.


Report Offensive Message For Removal

Response Number 1
Name: Michael J (by mjdamato)
Date: February 28, 2008 at 22:46:02 Pacific
Subject: can jpg or jpeg be animated?
Reply: (edit)

Nope. You will need to use GIF images if you want animation.

Michael J


Report Offensive Follow Up For Removal

Response Number 2
Name: Mobliz
Date: July 1, 2008 at 20:50:51 Pacific
Subject: can jpg or jpeg be animated?
Reply: (edit)

I know this is a post that is few months old, but the asker's question was never fully answered.

From www.webdevelopsnotes.com :

The jpg image format has no provision for animation, however, with a little JavaScript and a dash of creativity, we can easily make an "animated" jpg.
You should keep in mind that the animated jpg is not one image but a series of images that are displayed in the same place in the browser.

We start by preloading all the jpg images required in the "animation".

The second step is to use a function that changes the source of an image. Finally, we call this function repeatedly by employing the setTimeout() method.
'Animated' Jpg'

var c = 1;

/* Preloading images */
var image1 = new Image();
image1.src = "a1.jpg";
var image2 = new Image();
image2.src = "a2.jpg";
var image3 = new Image();
image3.src = "a3.jpg";
var image4 = new Image();
image4.src = "a4.jpg";
var image5 = new Image();
image5.src = "a5.jpg";

function disp_img(w)
{
if (c == 6)
{
c = 1;
}
var img_src = "a" + c + ".jpg";
document.ani.src = img_src;
c++;
}
t = setInterval("disp_img(c)", 1000);

The entire script is placed inside the HTML document HEAD section.
We start by initializing a global variable c that serves as a counter and is also a part of the image name. After preloading the images (an1.jpg, an2.jpg, an3.jpg, an4.jpg and an5.jpg), we define a function disp_img() that changes the source of images named ani. The function also checks the value of variable c, assigning it a value of 1 if its value exceeds 5. The variable is also incremented each time the function is called. The function is called after every 1 second (1000 milliseconds) with the setInterval() method.

You can customize the script and create .jpg slide-shows easily.


Report Offensive Follow Up For Removal

Response Number 3
Name: ChromeIndustry
Date: August 30, 2008 at 23:32:43 Pacific
Subject: can jpg or jpeg be animated?
Reply: (edit)

Check this out:
http://files.boardgamegeek.com/avat...
It is an animated JPG, that uses no visible Java.


Report Offensive Follow Up For Removal

Response Number 4
Name: dunpealx4
Date: September 1, 2008 at 18:05:21 Pacific
Subject: can jpg or jpeg be animated?
Reply: (edit)

thanks lot man.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: can jpg or jpeg be animated?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software