Commons:Stroke Order Project/Graphics guidelines/Bitmap animations using GIMP

Stroke Order Project's Animate Images' Tutorial edit

How to create the first layer edit

 
Stroke Order Base
  1. Before creating anything you must have a Chinese font installed
    1. Note: The recommended font is "TW-MOE-Std-Kai Regular"(which is only for traditional characters), here is a download link.
  2. Download the Stroke Order Base.png image and open it with GIMP.
  3. With the text tool write the Chinese character.
  4. Adjust its size in pixels till it is big enough and align it to the center with the help of the said image.
    1. Note: about the alignment read the image's description, for more details.
  5. Once the character is ready you'll end up with one text layer. To convert it to a normal layer, create a new one totally white below the text layer.
  6. Then right-click on the text layer and click on combine bellow.
  7. Name that layer as "black (1000ms)".
  8. Erase the base layer.

How to create the second layer edit

  1. Duplicate the first layer.
  2. Create a new layer totally white.
  3. Move it below the duplicated layer.
  4. Set the opacity of the duplicated layer in 25.0.
  5. Right-click on that layer and click on combine below.
  6. Name that layer as "grey (1000ms)".

How to create the layers of the first stroke edit

  1. Create a new layergroup and name it as "Image #1".

Note: you don't have to add "(100ms)", as that will be added automatically when "Optimize (for GIF)".

  1. Duplicate the first and the second layers.
  2. Move the duplicated layers into the Stroke 1 layergroup, the grey above and the black below, and name them as "strokes" and "black" respectively.

Note: click on the save button regularly, or you might lost your work.

  1. Perform a Stroke Division for all the strokes.
  2. Put guides and enlarge the image with the zoom tool. To start with the steps.

None: It is recommended that you create a Stroke Steps Diagram to know where to place the guides.

  1. To draw the steps.
    1. Make sure you have the "strokes" layer selected.
    2. Click on the eraser.
    3. In the eraser options, as brush select the smoothest circle. And adjust its size.
    4. Do the step.
  2. Duplicate the layergroup "Image #1", when you do this you don't need to change its name, it will automatically have this name "Image #2".
  3. Now repeat the process with the new layergroup. Till all the steps are completed. Following the Guidelines about the strokes section.

Once you are done with the last layergroup edit

  1. Add the time according to the Guidelines about strokes mentioned above.

Note, you can do this by making invisible all the layergroups, then start making them visible one by one from bottom to top, to see where and how much time each layergroup needs.
Note: When you add the name you can do it in for example this way "Image #8(500ms)", "Image #8 (500ms)" or "Image(500ms)#8", it doesn't matter because it will give the same result.

How to create a GIF edit

Note: you can see how the animation is in any minute, by clicking on Filters --> Animation --> Playback...

  1. Save the file.
  2. Click on Filters --> Animation --> Optimize (for GIF). This will produce a new file.
  3. Click on File --> Export As...
  4. There will appear a menu. Make sure it has the extension .gif. Name it and click on Export.
  5. Adjust the final options, mark it as animation and infinite loop, and finally click on Export.
  6. And it is done. You can close the new file without saving, it won't be used anymore.

Final Steps edit

  1. Finally upload the gif image adding the {{SOlicense}}.

Stroke Division edit

Before create the layers of the first stroke, it is recommended that you divide your character into strokes, in order to ease the work.
 
The stroke division is applied where there are two or more strokes spliced into certain point or points. The image from above shows three different cases where it occurs, at the left are the cases and at the right are how they end up at the end of the process.
 
Let's do it with an example, on this example we will divide the above image into strokes. In which the stroke order is the next: first the wan stroke followed by the na stroke.
 
Then create the first, the second layer according and the layers of the first stroke according to the tutorial and you will end up, with the result from above.
 
Now duplicate the "strokes" layer, select it and then select the area where the two strokes are crossing paths. And do the following.

  1. Click on Select -> Invert.
  2. Click on Edit -> Clear.
  3. Click on Select -> All.

Note: On the "How to ease the work" section is the Script-Fu code for those three steps.
 
After doing that you will end up with the above image.
 
Now select the "strokes" layer and reduce its opacity.
 
Now select the duplicated layer, then select the eraser tool and delete the dark grey area that corresponds to the wan stroke. When you are done you will end up with an image as the above.
And that it is, with that you have divided the character into strokes. Then you can continue with the rest of the steps of the tutorial.
Note: After you traced a stroke, make sure you set the opacity on all its layers to 100%.
 
And you will end up with an animated image.
That was a simple example, for characters with more strokes repeat the process until all the strokes are divided.

Guidelines about the strokes edit

Introduction: Every -order.gif image has to meet the following characteristics: Stroke shape, stroke steps, and stroke timing. Which will be explained in detail below.
Before continue these are the symbols that will be used in the next diagrams. Their use and function will be explained in the "stroke steps" section.
  Name = Step Mark.
  Name = Small Step Mark.
  Name = Curve Step Mark.


The following image shows the name of the strokes that will be used in these guidelines, click here for more information.
 

Stroke Shape edit

 

  • The Chinese characters are drawn by hand and with a brush, that characteristic should be visible in your rendering. The image from above is just for to give you an idea of how to the characters are traced(read its description for more details).

 

  • The image from above, shows an example of what is unacceptable and what is acceptable.

Stroke Steps edit

Step Marks edit

  Name = Step Mark: This symbol helps to divide a stroke into steps, it denotes a frontier among them.
 

  • When you are creating the animation for one stroke there must be 3 or more steps in lines and two for dots.

 

  • As you can see in the example, the number of steps vary depending on the size of the stroke.

Important note: Before placing any step marks, please divide the stroke into its components.
  
For example this shu stroke is divided in two components, as shown in the left image.
The right image shows the division for a more complex stroke.

Small Step Marks edit

  Name = Small Step Mark: These marks are only placed once the step marks are placed. They are smaller in distance, and are only used at the extremes of the stroke.
 

  • As you can see on the example, they are not used on pointy extremes, they are used on rounded extremes and extremes followed by another component.

  
These images show more examples.

Curve Step Marks edit

  Name = Curve Step Mark: This symbols are used only in curves, because the characters are drawn with a brush, normally one slows down in curves and speeds up in lines. That is why they are smaller in distance, to show that detail in the rendering.
 
This image shows an example of its use.

The use of the guides edit

  • To apply the "Stroke Steps" characteristic to your animation, make use of the guides(Here is more information), but first make a character diagram per the explained above. Once you have a diagram use it to know where to put the guides.
  • To remove all guides click on Image --> Guides --> Remove all guides.
  • It is better to work in a big area, so you can use the zoom tool to do so.

 
This is an example of how to place the guides for this heng stroke.

Diagram examples edit

On this section will be 5 diagram examples, with the purpose of helping you on its creation.
Note: They can also be done on paper.
   File:SOP stroke steps diagram example4.pngFile:SOP stroke steps diagram example5.png

Stroke Timing edit

  • A layer has this format "Name (100ms)", in which:
    • Name is the identifier of the layer.
    • (100ms) is the time, in this case (100ms) is the default time for each step.

 

  • See the graphic, the final step of each stroke vary in time, depending on the distance, the more the distance(between one final step and the following initial step) the more the time. Read the image's description for more details.
  • The time of the final step must be set as "(1000ms)".

 

  • When the final step of a component forms an angle of approximately 90º with the next component of the same stroke, then that step will have a time of "(150ms)", as shown in the graphic.

How to ease the work edit

  • You can configure the Gimp's shortcut, by clicking on Edit --> Keyboard Shortcuts, to do for example Quit all the guides, increase the size of the brush, etc. Or some activity that you do frequently.
  • You can investigate how to use Script-Fu code, it is meant for the purpose of to ease the work and to concentrate on the creative part.
  • You can use the code below:

  (script-fu-register
    "script-fu-stroke-order"                        
    "Stroke Order"                            
    "It saves you from the tedious and\
      repetitive task of the first steps\
      in the creation of a Chinese letter.\
      Add the time (150ms, 500ms, etc).\
      There is no need to add(100ms) to\
      each layer, it will be added\
      automatically in \"gif optimization\"."         
    "User:FanNihongo / Wikimedia Commons"                          
    "© User:FanNihongo / Wikimedia Commons / cc-by-sa-4.0"    
    "Thursday 23/May/2020"                      
    "" 
  ) 
(define (script-fu-stroke-order)
	(gimp-layer-new 1 300 300 RGB-IMAGE "black (1000ms)" 100 NORMAL-MODE) ;(3)
	(gimp-image-insert-layer 1 3 0 1)
	(gimp-drawable-fill 3 WHITE-FILL)
	(gimp-image-merge-down 1 2 EXPAND-AS-NECESSARY) ;(4)
	(gimp-layer-new-from-visible 1 1 " ") ;(5)
	(gimp-image-insert-layer 1 5 0 0)
	(gimp-layer-new 1 300 300 RGB-IMAGE "grey (1000ms)" 100 NORMAL-MODE) ;(6)
	(gimp-image-insert-layer 1 6 0 1)
	(gimp-drawable-fill 6 WHITE-FILL)
	(gimp-layer-set-opacity 5 25)
	(gimp-image-merge-down 1 5 EXPAND-AS-NECESSARY) ;(7)
	
	(gimp-layer-group-new 1)  ;(8)
	(gimp-image-insert-layer 1 8 0 0)
	(gimp-item-set-name 8 "Image #1")
	(gimp-layer-copy 4 TRUE) ;(9)
	(gimp-layer-copy 7 TRUE)  ;(10)
	(gimp-image-insert-layer 1 9 8 0)
	(gimp-image-insert-layer 1 10 8 0)
	(gimp-item-set-name 9 "black")
	(gimp-item-set-name 10 "strokes")
	

) 

  • To use that code you'll have to meet the next condition: It will work in a just opened file where the aligned Chinese letter is the only layer. The code will do some of the steps described above.
    • To install the code just copy the code into a .scm file and move it into the Gimp's "scripts" folder.
    • To use the code, open the Script-Fu console, by clicking on Filters --> Script-Fu --> Console, and execute it with the command: "(script-fu-stroke-order 0)".

Note: you can also create a shortcut that executes the code.

  • You may also can create the stroke order animation of components, to later use your edition skills to join them together with other letters in order to create new ones. For example you could have this animated component "日" and join it with the character "雲" resulting in the following character "曇".

Stroke Division's Script-Fu code edit

  
(script-fu-register
    "script-fu-SOPsd"                        
    "Stroke Division"                
    "This function helps on the Stroke Division process"     
    "User:FanNihongo / Wikimedia Commons"                                     
    "© User:FanNihongo / Wikimedia Commons / cc-by-sa-4.0"              
    "Wednesday 13/Jan/2022"                
    "" 				
  )   

(define (script-fu-SOPsd)
	(gimp-selection-invert 1)
	(gimp-edit-clear (car (gimp-image-get-active-layer 1)))
	(gimp-selection-all 1)

)