Author Topic: Creating GIFs  (Read 3027 times)

June 05, 2018, 09:37:44 PM
Read 3027 times

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
Hi
I'm interested in making short and simple Gifs.
Like blinking eyes, or a button pushed on and off for example.
Is this possible with Inkscape and what is the procedure?

Thanks
  • 0.92.3
  • Windows 10

June 06, 2018, 05:28:26 AM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln

June 06, 2018, 09:42:42 PM
Reply #2

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Just for clarity, Inkscape can't do the animation.  Inkscape can only make the images.  You have to export a PNG for each "frame", and then use another program to put them together into an animation.

GIMP, which is an open source raster editor, has a simple animation feature.  I've used it myself, and found it easy to use.  As far as I recall (it's been a long time) I used Import as Layers, to import each "frame" one at a time (as GIMP requires each frame to be on its own layer) (or at least, it did at that time).  It was a fairly simple animation, with only about 12 to 15 frames.  But if you're making something more complex, you'll probably want something which can handle batch imports.

Over the years, there have been a few different Inkscape extensions which will handle parts of this general process, but I've never tried any of them, so I don't know exactly what all they would do.  I don't think any of them did the actual animation, but I don't know for sure.  I also don't know if any of them are still working with the current Inkscape version.  You can find them at the links Moini gave.

(All the known Inkscape extensions are found in those 3 locations, combined.  I'm working on putting them altogether, and on the Home tab here, where they will join the listings of tutorials there now.  If nothing else in my life breaks, maybe I'll get it done pretty soon, haha.)

If you could let us know what you learn with your investigation, it would allow us to help others (with more info than what I've been able to give you).
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 07, 2018, 09:45:37 AM
Reply #3

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
YES, it works.  :yay:
Kudos to brynn and Moini.

@brynn: I definitely want to help. So here is a few key points to make GIFs that work like a charm with Inkscape + GIMP

- Installing

1. Download the plugin files as Moini said https://gitlab.com/su-v/inx-exportobjects
2. Unzip and copy files to C:\Program Files\Inkscape\share\extensions (windows)
3. Launch Inkscape

- Creating GIFs

General:
1. Think of Layers as Frames and the position of each Layer as the Camera
For my "blinking eyes" project for example, I created two layers (frames) overlapping.  Eyes shouldn't be moving. Only blinking.
If i had to create a flying bird, layers should be apart.

Inkscape:
1. Group the objects (if more than one) in each layer.
2. Export as plain PNG Background Default Color alpha=1. This will keep the white page as background, preventing GIMP to import PNGs in a layer filled with transparency.

GIMP
1. Open as Layers in GIMP, and select all *.png images generated by Inkspace (Holding Ctrl key)
2. Delete the default Background Layer
3. Preview your GIF from Filters->Animation->Playback
4. If you are happy with the result Export As *.gif
5. Make sure "As animation" is selected and the most important "Frame Disposal where unspecified" is set to: One frame per Layer (replace). Otherwise frames will stack one another. Also tick "Use disposal endered above for all frames"
6. Set "Delay between frames where unspecified" in milliseconds


Hope that helps.


« Last Edit: June 07, 2018, 10:23:40 AM by lefteris.lydios »
  • 0.92.3
  • Windows 10

June 07, 2018, 10:16:52 AM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Omgosh, that is fabulous!!

I am curious why it's important to save the white background (via Plain SVG).  What if you want a transparent background?  Like for example, if I wanted to make an animated smiley.  It would need transparent background.

And also, why save the white background, if you're just going to delete that layer in GIMP?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 07, 2018, 10:22:47 AM
Reply #5

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
Well, allow me to correct myself. I didn't export SVGs at all, I exported PNG with alpha=1. For some reason GIMP 2.0 kept crashing with transparent backgrounds.
I'm updating my post.
  • 0.92.3
  • Windows 10

June 07, 2018, 10:27:00 AM
Reply #6

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Interesting, given that the extension can export to animated gif already...? Why did you need to use Gimp?

June 07, 2018, 10:28:54 AM
Reply #7

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
because I get the message "Export format GIF not available." Don't know why.
  • 0.92.3
  • Windows 10

June 07, 2018, 10:33:44 AM
Reply #8

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
 If you guys can spare a couple of minutes, can you test it?
  • 0.92.3
  • Windows 10

June 07, 2018, 10:54:01 AM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
So that extension, called https://gitlab.com/su-v/inx-exportobjects actually provides the animation??  I guess I shouldn't be surprised that developers have their own language, haha.

I don't know if I have time right now to test it.  I'd have to create at least a 3 frame animation....  I'll try it.

Edit
I thought extensions needed both INX and PY file.  How can this work with only INX file?

I thought once I followed the link, I would see a name for the extension which indicates it provides the animation.  But still, the name is only "inx-exportobjects".  Maybe still needs a bit of polish?

Edit #2
I found the PY file, it's buried inside some nested folders.  Now -- think of a quick animation test....maybe I'll just rotate a needle (since someone else is doing that, but using other techniques and wares, in a different topic).

Edit #3
Actually that dialog is much more complex than I expected. So I'm not going to have time today, to figure it out.  But I'll put on my to-do list, and plan on trying it pretty soon.

My first question -- I would assume that GIF is needed for the animation.  So why does it offer to export SVG, PNG, JPG, PDF, as well as GIF?  Plus, I'm a little confused with the concept of exporting SVG.  Is this just providing the option for saving in a batch, as far as the non-GIF formats?

By the way, regarding the naming.  In the Extensions menu, Export submenu, it's called Objects to Files....  Go figure  :uhoh:
« Last Edit: June 07, 2018, 11:41:01 AM by brynn »
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 07, 2018, 11:53:56 AM
Reply #10

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
The plugin exports all layers as single files. Sounds like a useful tool. It depends on your needs though.
  • 0.92.3
  • Windows 10

June 07, 2018, 03:04:58 PM
Reply #11

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
It also exports as animated gif - there's an 'animation' tab, I think it's the third or fourth one...

June 07, 2018, 03:10:15 PM
Reply #12

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
As for the 'Export format gif...' error message, please read the instructions that come with the extension, it's item 3.) (install imagemagick http://imagemagick.org/ ).

June 08, 2018, 09:45:02 PM
Reply #13

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
Does Imagemagick launch within Inkscape when you try to export as GIF or you have to use it as a separate app like GIMP?
  • 0.92.3
  • Windows 10

June 09, 2018, 09:21:49 AM
Reply #14

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
The extension calls it, you won't even notice that it's happening. It does not have a graphical user interface.

June 09, 2018, 11:25:21 AM
Reply #15

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
To be clear, it does not say "install ImageMagic".  It cryptically says that it depends on Imagemagic (which a non-advanced user reading that could probably care less), and further implies that Windows and Mac users might not have the full program.  To me, the instructions about needing to install another program need to be at the very top.

Although to be fair, it doesn't sound like ~suv intends for it to be fully formed and ready for use.  It sounds like she was just experimenting, and ended up with something that mostly works.  All this (and probably other things, although I did not read closely) should be explained to the user, if we plan to start recommending this as a regular Inkscape tool.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 09, 2018, 11:37:37 AM
Reply #16

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
I installed it. Inkscape never called it. If someone could help me I'd appreciate.
  • 0.92.3
  • Windows 10

June 10, 2018, 09:14:30 AM
Reply #17

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
lefteris, can you describe exactly what you do, and what you get? It might be an issue with conflicting names (imagemagick is called by the command 'convert', and that command is already the same as a built-in Windows command). That's fixable, though.

Can you try if this replacement file works (it checks which operating system one is on, and adjusts the command to be used):
https://gitlab.com/Moini/inx-exportobjects/blob/patch-1/src/export_objects.py

(not tested)

June 10, 2018, 01:05:16 PM
Reply #18

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
Sure. Thanks for your help.

At first, please take a look at this:  https://www.dropbox.com/s/u65pqdumjebsyvs/gif-fail.avi?dl=0
If everything looks fine and I'm not doing something completely wrong, then I'll try adding the script you suggested.
  • 0.92.3
  • Windows 10

June 10, 2018, 04:29:13 PM
Reply #19

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Yes, please try the updated extension.

(You had selected to export 'selected' objects in the first tab, but there was nothing selected. So with the settings in your video, there would be no gif created. However, the error message is the one the extension gives when it can't find imagemagick, so that's the first thing we need to fix, before we can look at any usage problems.)

June 10, 2018, 08:59:20 PM
Reply #20

lefteris.lydios

  • Jr. Member

  • Offline
  • ***

  • 22
  • Gender
    Male

    Male
In the video, I selected both layers via the Objects menu.
If nothing is selected, a message pops up.
I'll try with the new file and post back.
  • 0.92.3
  • Windows 10

June 13, 2018, 05:24:09 PM
Reply #21

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I don't think it's built for using selected layers like this - it might still work, but it's meant to use either objects that are selected on the canvas if the 'selected' tab is active, or layers, when the layers tab in the dialog is active.