Skip to content

Commit

Permalink
o Use GraphicsMagick instead of ImageMagick as it scales jpgs correctly
Browse files Browse the repository at this point in the history
  and also uses less CPU
  • Loading branch information
hzeller committed Mar 5, 2015
1 parent aaeb443 commit 744ccd1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ RGB_LIBRARY=$(RGB_LIBDIR)/lib$(RGB_LIBRARY_NAME).a
LDFLAGS+=-L$(RGB_LIBDIR) -l$(RGB_LIBRARY_NAME) -lrt -lm -lpthread

# Imagemagic flags, only needed if actually compiled.
MAGICK_CXXFLAGS=`Magick++-config --cppflags --cxxflags`
MAGICK_LDFLAGS=`Magick++-config --ldflags --libs`
MAGICK_CXXFLAGS=`GraphicsMagick++-config --cppflags --cxxflags`
MAGICK_LDFLAGS=`GraphicsMagick++-config --ldflags --libs`

all : $(BINARIES)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ clears the screen (if you want to display an empty line, just send a space).

One of the possibly useful demo applications is an image viewer that
reads all kinds of image formats, including animated gifs. It is not compiled
by default, as you need to install the imagemagick dependencies first:
by default, as you need to install the GraphicsMagick dependencies first:

sudo aptitude install libmagick++-dev
sudo aptitude install libgraphicsmagick++1-dev
make led-image-viewer

Then, you can run it with any common image format:
Expand Down
10 changes: 6 additions & 4 deletions led-image-viewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <vector>
#include <Magick++.h>
#include <magick/quantum.h>
#include <magick/image.h>

using rgb_matrix::GPIO;
using rgb_matrix::FrameCanvas;
Expand Down Expand Up @@ -58,9 +58,9 @@ class PreprocessedFrame {
CoordinateMapping(x, y, &drawX, &drawY);
if (c.alphaQuantum() == 0) {
output->SetPixel(drawX, drawY,
MagickCore::ScaleQuantumToChar(c.redQuantum()),
MagickCore::ScaleQuantumToChar(c.greenQuantum()),
MagickCore::ScaleQuantumToChar(c.blueQuantum()));
ScaleQuantumToChar(c.redQuantum()),
ScaleQuantumToChar(c.greenQuantum()),
ScaleQuantumToChar(c.blueQuantum()));
}
}
}
Expand Down Expand Up @@ -159,6 +159,8 @@ static int usage(const char *progname) {
}

int main(int argc, char *argv[]) {
Magick::InitializeMagick(*argv);

int rows = 32;
int chain = 1;
int parallel = 1;
Expand Down

0 comments on commit 744ccd1

Please sign in to comment.