Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

34
LINES

< > BotCompany Repo | #1003675 // Test GifSequenceWriter

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (3400L/24K/80K).

!7

p {
  new L<File> images;
  for (S id : splitAtSpace("#1003635 #1003670"))
    images.add(loadLibrary(id));
    
  // makes the parent directory
  File gifFile = prepareProgramFile("animated-speaker.gif");
    
  // grab the output image type from the first image in the sequence
  BufferedImage firstImage = ImageIO.read(images.get(0));

  // create a new BufferedOutputStream with the last argument
  ImageOutputStream output = fileImageOutputStream(gifFile);

  // create a gif sequence with the type of the first image, 500 ms
  // between frames, which loops continuously
  GifSequenceWriter writer = 
    new GifSequenceWriter(output, firstImage.getType(), 500, true);

  // Write images
  
  writer.writeToSequence(firstImage);
  
  for (int i=1; i < l(images); i++) {
    BufferedImage nextImage = ImageIO.read(images.get(i));
    writer.writeToSequence(nextImage);
  }

  writer.close();

  print("Wrote " + n(l(images), " frame") + " to: " + gifFile.getAbsolutePath());
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1250 stefan Works! :-) 2016-07-25 16:50:34

add comment

Snippet ID: #1003675
Snippet name: Test GifSequenceWriter
Eternal ID of this version: #1003675/4
Text MD5: ba37bd7f7672fa23e9f85fd52663feed
Transpilation MD5: ddf429376ddbcfc6f51e6844f0bcd763
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-30 13:21:05
Source code size: 1018 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 889 / 1031
Version history: 3 change(s)
Referenced in: [show references]