Hidden 10 yrs ago Post by Kaga
Raw
OP
Avatar of Kaga

Kaga just passing through

Member Seen 7 yrs ago

Spam, I want you all to look closely at the gif in my signature.

Particularly, I want you to see how it is technically not a gif, and actually a jpg.

...Someone please explain to me how that's possible.
Hidden 10 yrs ago Post by aza
Raw

aza Artichokes

Member Seen 9 mos ago

Communism
Hidden 10 yrs ago Post by HollywoodMole
Raw

HollywoodMole

Member Seen 9 yrs ago

What the ever loving beaver bucks?
Hidden 10 yrs ago Post by natsumehack
Raw

natsumehack

Banned Offline since relaunch

Kaga said
Spam, I want you all to look closely at the gif in my signature.

Particularly, I want you to see how it is technically not a gif, and actually a jpg.

...Someone please explain to me how that's possible.


http://www.computing.net/answers/digitalphoto/can-jpg-or-jpeg-be-animated/1314.html
Mobliz said
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.
Hidden 10 yrs ago Post by natsumehack
Raw

natsumehack

Banned Offline since relaunch

You are welcome kaga.
Hidden 10 yrs ago Post by Darog the Badger God
Raw
Avatar of Darog the Badger God

Darog the Badger God Kawaii on the streets Senpai in the sheets

Member Seen 4 yrs ago

Eww Doctor Who.
Hidden 10 yrs ago Post by Kaga
Raw
OP
Avatar of Kaga

Kaga just passing through

Member Seen 7 yrs ago

natsumehack said
http://www.computing.net/answers/digitalphoto/can-jpg-or-jpeg-be-animated/1314.html


Huh... that actually makes a ton of sense. Thank you.
Hidden 10 yrs ago Post by natsumehack
Raw

natsumehack

Banned Offline since relaunch

Kaga said
Huh... that actually makes a ton of sense. Thank you.


it took me 1 minute Google searching to find it.
Hidden 10 yrs ago Post by Iota
Raw
Avatar of Iota

Iota

Member Seen 8 yrs ago

The title of the thread suggests that the internet made sense at some point.
↑ Top
© 2007-2024
BBCode Cheatsheet