Blog

  • How to: add images to reddit sidebar

    Here is one quick and dirty way to add an image to the sidebar of a subreddit. You must be a moderator of a subreddit in order to edit its stylesheet.

    1. Upload the image
    2. Add this CSS to the stylesheet:
      /* add image to the bottom of the sidebar */
      .side .usertext-body{ padding-bottom: 400px; background: url(%%image_name%%) no-repeat; background-position: bottom center; }
    3. Replace %%image_name%% with the name of your uploaded image
    4. Change padding-bottom: 400px; to a value in pixels that is at least the height of your image

    Similarly, here is a CSS code that will add an image to the top of the reddit sidebar:

    /* add image to the top of the sidebar */
    .side { padding-top: 400px; background: url(%%image_name%%) no-repeat center; }

    This adds a background image to the sidebar and positions it at the bottom. The padding creates enough blank space to make the image visible.

    This won’t work if you already have a background image on the the sidebar as part of other visual changes on the subreddit.

  • gif2frames.exe: Extract frames from an animated GIF

    I built a Windows 32 bit command line executable, gif2frames.exe. (Go to download)

    This tool will take an animated GIF image file and save a separate static image for each frame in PNG, BMP or JPG format.

    The reason GIFs are useful is because the files can be optimized to reduce the size on disk. If a frame is visible for 1 or 10 seconds, a single copy of the frame may be stored inside the image file and a frame delay can help the player coordinate the animation.

    For this reason, when you say “extract frames from a gif file” you could mean two things; each unique frame could be extracted just once, or each frame could be extracted for each unit of time it is visible. If you want the latter, you must then decide on a rate of frames per second.

    Also interesting: the timing is funny business. Minimum frame rates (per second) can be determined by the software displaying the GIF file (more info at the bottom of this page). This makes the number of frames in a film strip style export of frames hard to calculate. I workaround this problem by finding the frame with the shortest display time and divide all the other times by this number. This means animations where all frames are shown for three seconds will only produce one image for each frame. If this is not what you are looking for, try ImageMagick (convert.exe).

    Usage

    Here are a few cmd.exe examples showing basic calls.

    Animated GIF to PNG images

    C:\>gif2frames.exe at.gif

    Animated GIF to BMP images

    gif2frames at.gif -bmp

    Animated GIF to JPG images

    gif2frames at.gif -jpg

    Only unique frames

    gif2frames at.gif -png -unique

    Downloads