KDE, Linux, OpenSuse

BIR – Linux GUI Batch Image Resizer

Images from your digital camera tend to be big. Really big. Even with our broadband connections having a slideshow of 5mb images does not make a lot of sense. If you want to email images you probably want to resize them all before you send them. There are also situations where you have images of many different sizes and you want to resize them uniformly. With a quick Google search I couldn’t find any way to do this that didn’t involve a command line. I set out to create a batch image resizer with a GUI similar to the ones I’ve used on Windows.

Its called BIR for Batch Image Resizer. It came out looking like this:

Linux batch image resizer
BIR – The Linux batch image resizer

Along with resizing it will also rotate your images and crop them. It has plenty of options for fine tuning. It can resize a directory recursively and preserve your directory structure in the destination folder. I coded this so it looks at all the images and finds the first parent folder that all of the files share. Alternatively, you can also set it so all of the resized files end up on the same folder with no subdirectories. I’ve tested it with hundreds of files and it seems to work fine no matter how much you throw at it.

It can resize almost any type of file you would need to resize. The list of formates are:

  • BMP Windows Bitmap
  • JPG Joint Photographic Experts Group
  • JPEG Joint Photographic Experts Group
  • PNG Portable Network Graphics
  • PPM Portable Pixmap
  • TIFF Tagged Image File Format
  • XBM X11 Bitmap
  • XPM X11 Pixmap

Thanks to some helpful people on Reddit people have tested it and helped me iron out any issues they discovered

The source code is available here:
https://github.com/agronick/BIR

Here you can find packages for OpenSuse, Fedora, RedHat, and CentOS.

Here you can find the package on the OpenSuse Build Service.

Version 2.0 fixes some issues with Ubuntu and all the code is updated for Qt5. If you need to compile it you use the same exact steps you used for qt4 except the qmake command might be qmake-qt5.

Compiling the Batch Image Resizer
If you rather not deal with resolving dependencies yourself you can download Qt from the Qt website. You can also download Qt-Creator which is the IDE I used to create this program.

If┬áthere are no precompiled release for your distro you can compile a release very easy. You just need the dependencies for Qt5. The development package will probably have a suffix like -dev. With a command like this you can search for packages with the letters “qt5” in them that also has the string “-dev”. This works for Ubuntu.

sudo apt-cache search qt5 | grep "dev"

So anyways, once you get the sources and dependencies compiling and installing is very easy.

$ mkdir build
$ cd BIR/build
$ qmake-qt5 ../  
$ make
$ sudo make install

Thats all there is to it. The program should appear in whatever launcher you use.

Advertisements
Linux

Stream a Reddit thread’s comments into a terminal window

Whenever I watch a football or hocky game I like to pull up the Reddit threads that are discussing them to see people’s reactions. I was a pain to refresh the screen and it would be so much better if you could see the comments streaming in real time. I came up with this little script using node and you can have it running in just a few minutes.reddistream2

To invoke it you just run

reddistream <URL of comments>

Thats it. The page updates every five seconds with the newest comments at the bottom.

To install Reddistream first install the Node package manager however its done on your system. That will bring in NodeJS as a dependency. Then you just need to install Reddistream:

sudo npm install reddistream -g

Now open up some Reddit comments and run Reddistream followed by the URL and watch the comments flow in.

Heres the github: https://github.com/agronick/reddistream
and
The NPM link: https://www.npmjs.org/package/reddistream

This lets you do lots of coll stuff because its in a terminal window. You can monitor for activity. You can pipe to other commands and you can redirect your output to a file.

Edit: So I added some new features.

  • It now clearly says who replied to a comment.
  • Comments are indented based off how many parent comments they have
  • Quotes are now italic
  • You can turn off these features by putting -r to disable showing who replied to a post and -i to disable indenting comments.