Donmai

How to upload ugoira, the new pixiv animation system

Posted under General

For all who have no idea how to just save let alone upload that abomination, there are a few scripts helping with the procedure. It's still tedious work though, so you may want to wait until uploading these things is integrated into danbooru.

You still want to go at it?

Toks wrote a ruby script that does bacically everything you need, this is going to be integrated into danbooru in the near future. You can find it here.
Problem is, it's quite complicated to install, especially the imagemagick part, especially on windows boxes. You can find info about that here and here.

There is also a perl script doing most of the work, but it's buggy. You can find it here.

There is also a tool that downloads the zip with all the pictures, you have to do most of the evil work (converting) yourself, though. You can find it here.

Here is a bookmarklet doing the same as above tool:

javascript:window.location = pixiv.context.ugokuIllustFullscreenData.src;

If you want to convert ugoira, be warned: The framerate is variable. Most image tools do not allow that.

Here is a bookmarklet to get the frame delay data:

javascript:var%20str%20=%20"";var%20frames%20=%20pixiv.context.ugokuIllustFullscreenData.frames;for%20(var%20i%20=%200;%20i%20<%20frames.length;%20i++)%20{str%20+=%20frames[i].file%20+%20":%20"%20+%20frames[i].delay%20+%20"\n";}alert(str);%20window.location%20=%20pixiv.context.ugokuIllustFullscreenData.src;

Here is another tool for windows boxes, that downloads ugoira and converts them to gif, the timing is wonky, though. You need at least .net 4. You can find it here.

More converter scripts for webm and GIF, same requirements as Tok's script, find them here.

There's a new script for GIF converting, find it here.

That should be all for now.

Edit: Added yet another tool.

Updated

OOZ662 said:

I'm no expert and I'm light on sleep, but it looks like it'ss using Silverlight or somesuch. Sounds like it's gonna be a pain.

It's just a canvas element, and javascript is used to load/display the individual frames for certain durations inside the frame.
That means pixiv does not have the whole animation saved within 1 file. You would have to make that yourself.

It's basically a media player that plays back a set of images at whatever rate the user sets it to. There is a workaround to get an actual gif but it's rather tedious:

http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44305721

1. View Page Source.
2. Ctrl+F, search for _ugoira1920x1080.zip (take note of the "delay", 100 in this case).
3. Copy the link, get rid of the forward slashes (/).
4. Save the zip (Gonna have to use something like RefControl so that you don't get 403'd)
5. Unzip, open the first frame using GIMP, open the rest as layers. (Make sure they're in reverse order, i.e: the first frame in the layer list should be 000011.jpg, GIMP should do this automatically.)
6. Export as a gif, check the As Animation box, set the delay to 100, Save.

And presto, a gif! http://i.imgur.com/UhViwdC.gif

I'm sure someone out there can write up a script or something to automate this, pretty please?

Ars said:

It's basically a media player that plays back a set of images at whatever rate the user sets it to. There is a workaround to get an actual gif but it's rather tedious:

http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44305721

1. View Page Source.
2. Ctrl+F, search for _ugoira1920x1080.zip (take note of the "delay", 100 in this case).
3. Copy the link, get rid of the forward slashes (/).
4. Save the zip (Gonna have to use something like RefControl so that you don't get 403'd)
5. Unzip, open the first frame using GIMP, open the rest as layers. (Make sure they're in reverse order, i.e: the first frame in the layer list should be 000011.jpg, GIMP should do this automatically.)
6. Export as a gif, check the As Animation box, set the delay to 100, Save.

And presto, a gif! http://i.imgur.com/UhViwdC.gif

I'm sure someone out there can write up a script or something to automate this, pretty please?

Here's a bookmarklet that does the first 4 steps (as soon as you click it your browser prompts you to download the zip):

javascript:window.location = pixiv.context.ugokuIllustFullscreenData.src;

Toks said:

Here's a bookmarklet that does the first 4 steps (as soon as you click it your browser prompts you to download the zip):

javascript:window.location = pixiv.context.ugokuIllustFullscreenData.src;

Excellent, that's one pain in the ass eliminated.

Oh, and here's a bookmarklet that tells you the delay before you download the file:

javascript:alert("Delay: " + pixiv.context.ugokuIllustFullscreenData.frames[0].delay + "ms"); window.location = pixiv.context.ugokuIllustFullscreenData.src;

Note that it only tells you the delay of the first frame. The other frames could be different, though I haven't seen this yet.

S1eth said:

Pixiv allows you to set a different delay for each individual frame.

You can use this if you want the full list:

var str = "";
var frames = pixiv.context.ugokuIllustFullscreenData.frames;
for (var i = 0; i < frames.length; i++) {
  str += frames[i].file + ": " + frames[i].delay + "\n";
}
alert(str);

Though it would be time consuming typing each of them into gimp so I don't know who'd actually do this.

S1eth said:

BTW, upload gifs or apng? (given jpeg images)

apng has better quality, it won't reduce the number of colors like a gif will. Though gif has better browser support. I think Firefox is the only browser that support apng out of the box.

The gif color reduction isn't noticeable on simple examples like ars's, but try it on something like pixiv #44315772 (lots of gradients and unique colors) and the quality loss is obvious.

S1eth said:

On the other hand, we probably wouldn't allow uploads that change the animation from the way it was intended by the creator.

Obviously you can't upload an image if you didn't use the correct delays. I meant that people might want to just not do this manually, either wait for a fully automatic way or don't upload these at all.

Toks said:

Obviously you can't upload an image if you didn't use the correct delays. I meant that people might want to just not do this manually, either wait for a fully automatic way or don't upload these at all.

most of them don't have changing delays, at least for now

So we shouldn't be uploading any of these just yet? I wanted to try my hand at gif-ifying one of these and as someone whose never used gimp before it was pretty easy thanks to this topic. As a test I made a gif out of pixiv #44303110 ( http://imgur.com/6qi3Jcz ). The only thing is I can't seem to get the code that shows the delay on every frame to work (I can't save it as a bookmark, I'm not even sure that's how you're supposed to use that though) I set the delay as the same as the first frame (100 ms) but I wouldn't be surprised if sb would put the effort into changing the delay on individual frames. I can't figure out any kind of reliable way of comparing the gif to the source (it seems to slow down on pixiv and I don't know if that's my browser loading it slowly or if it's meant to play that way and besides that I can't get the two to start simultaneously anyway).

After all that I guess it makes more sense to just wait until there is a fully automated way to upload these.

When you make the new bookmark and paste the code into the address bar, add "javascript:" before the code, just like you see it in the other examples.

javascript:var str = "";var frames = pixiv.context.ugokuIllustFullscreenData.frames;for (var i = 0; i < frames.length; i++) {str += frames[i].file + ": " + frames[i].delay + "\n";}alert(str);
1 2 3 4 5 10