From c9f5f96432c871834baef45c1fead2e80ba3c88e Mon Sep 17 00:00:00 2001 From: otzy_007 Date: Thu, 13 May 2010 00:58:21 +0200 Subject: graphics/metapixel: Added to 13.0 repository --- graphics/metapixel/README | 6 + graphics/metapixel/README.SLACKWARE | 380 ++++++++++++++++++++++++++++++++ graphics/metapixel/metapixel.SlackBuild | 78 +++++++ graphics/metapixel/metapixel.info | 10 + graphics/metapixel/slack-desc | 20 ++ 5 files changed, 494 insertions(+) create mode 100644 graphics/metapixel/README create mode 100644 graphics/metapixel/README.SLACKWARE create mode 100644 graphics/metapixel/metapixel.SlackBuild create mode 100644 graphics/metapixel/metapixel.info create mode 100644 graphics/metapixel/slack-desc (limited to 'graphics') diff --git a/graphics/metapixel/README b/graphics/metapixel/README new file mode 100644 index 000000000000..74f9322b6efd --- /dev/null +++ b/graphics/metapixel/README @@ -0,0 +1,6 @@ +Metapixel is a program for generating photomosaics. It can generate +classical photomosaics, in which the source image is viewed as a +matrix of equally sized rectangles for each of which a matching image +is substitued, as well as collage-style photomosaics, in which +rectangular parts of the source image at arbitrary positions (i.e. not +aligned to a matrix) are substituted by matching images. diff --git a/graphics/metapixel/README.SLACKWARE b/graphics/metapixel/README.SLACKWARE new file mode 100644 index 000000000000..0a51f1f9b35f --- /dev/null +++ b/graphics/metapixel/README.SLACKWARE @@ -0,0 +1,380 @@ +Metapixel 1.0.2 +=============== + +Metapixel is a program for generating photomosaics. It can generate +classical photomosaics, in which the source image is viewed as a +matrix of equally sized rectangles for each of which a matching image +is substitued, as well as collage-style photomosaics, in which +rectangular parts of the source image at arbitrary positions (i.e. not +aligned to a matrix) are substituted by matching images. + + +Installation +------------ + +To compile Metapixel, you need, in addition to a C compiler, libpng, +libjpeg, and giflib. To run the script for preparing constituent +images, you will additionally need Perl. Most Linux distributions +contain these software packages. On MacOS X, you can get them with +Fink (http://fink.sourceforge.net/). + +Edit the first line of Makefile if you want to install Metapixel +somewhere else than /usr/local. Then, type + + make + +If everything compiled fine, become root and type + + make install + + +Configuring Metapixel +--------------------- + +You can optionally create a file ".metapixelrc" in your home directory +to store some settings which makes it easier to use Metapixel, since +you won't have to use that many switches on the command line. + +A sample configuration file is included in the Metapixel distribution +under the name "metapixelrc". See the section "The Configuration +File" below for details. It is advisable to at least set the options +"prepare-directory" and "library-directory". + + +Preparing images +---------------- + +Before (non-anti-mosaic) mosaics can be created, the constituent +images need to be preprocessed. Preparing an image does two things. +Firstly, it computes various coefficients by which the image can be +matched against a part of a source image. Secondly, the image is +scaled to a smaller size. Usually this will be the size you intend to +use for it in the target image, but it can be any arbitrary size. It +makes sense to scale your images to the maximum size that you will use +for constituent images. That way, no information gets lost. The +default size is 128x128 pixels. The matching data and the scaled +images are stored in a directory which is then called a "library". +You can use more than one library in the creation of a mosaic. + +To simplify the task of creating a library, the Perl script +'metapixel-prepare' is included in the distribution. It must be +called with the name of the directory where your original images are +stored in. As a second argument you must give the directory of the +library to which the images are to be added. If you have set a +default directory for preparing images in your configuration file, +the second argument is optional. + +If the script is called with the option "--recurse", it searches the +directory with the original images recursively, i.e., it searches all +its direct and indirect subdirectories as well. It also accepts +parameters specifying the size of the scaled down images. Just call +it - it prints out usage information. + +If the script constantly complains that an error occurred when running +'metapixel', that probably means that metapixel is not in your path. +The other possibility is that all your images are in a format that +Metapixel doesn't like (it only supports JPEG, PNG, and GIF). + + +Creating photomosaics +--------------------- + +Input images for mosaics can have arbitrary sizes. Should you want +the created mosaic to be of a different size than the input image, use +the --scale option. It scales the input image uniformly in both +directions (i.e. obeying the aspect ratio). If the width or height of +the input image after scaling are not multiples of the width and +height of the constituent images, the input image is further scaled up +to the smallest size (larger than the input image) that obeys this +constraint, possibly changing the aspect ratio a bit. This does not +apply to collages, however. The sizes of their source images after +scaling are always left untouched. + +Metapixel produces output images in the PNG or JPEG formats, depending +on the extension of the output file name. In order to create a +classic photomosaic for the image input.jpg and write the output to +output.png with constituent images stored in the directory "images", +use the following command line: + + metapixel --library images --metapixel input.jpg output.png + +To create a collage use + + metapixel --library images --collage --metapixel input.jpg output.png + +Using the -y, -i and -q options you can change the weights for each of +the color channels. For example, to match only luminance, completely +disregarding chrominance, use + + metapixel --library images -i0 -q0 --metapixel input.jpg output.png + +The default weight for each of the channels is 1. + +Using the --cheat option you can specify the percentage by which the +resulting photomosaic should be overlayed by the original image. The +default is 0, i.e., the photomosaic is not overlayed at all. A +percentage of 100 yields, not surprisingly, the original image. A +percentage of 30 makes the photomosaic appear noticably better but is +yet small enough to go unnoticed without close inspection in most +circumstances. + +As of version 0.6, Metapixel implements two different matching +algorithms. The new metric, which is a trivial distance function, +seems to give better results while not being slower than the old +wavelet metric. The metric can be chosen using the --metric option. +The default is the new subpixel metric. + +You can use the --library option more than once to let Metapixel use +more than one library for a mosaic. + + +Classic Mosaics +--------------- + +Metapixel allows you to choose between two algorithms for finding +matching images, via the --search option. The old algorithm called +"local" simply selects the best matching image for each location, +possibly disregarding images selected in locations nearby (see below). + +The new algorithm called "global" repeats the following step until all +locations have been assigned to: Find the best match for any location +among all small images that have not already been used. This +guarantees that no small image is used twice. Obviously, it also +means that you must have at least as many small images as there are +locations in the image. + +Note that "global" is much slower and uses more memory than "local". + +The "--distance" option lets you specify the minimal distance between +two occurences of the same constituent image in the target image for +the "local" algorithm. Distance 0 means that it is allowed for the +same image to occur in adjacent positions in the matrix. The default +distance is 5, which means that there must be at least 5 images +"between" two occurences of the same image in the matrix. Note that +Metapixel is forced to select non-optimal matches for distances +greater 0. + + +Antimosaics +----------- + +Antimosaics are classic mosaics for which the small images are the +parts of a single image, possibly the input image itself, and can be +created using the --antimosaic option. Metapixel subdivides the +antimosaic file as if it were doing a mosaic of that file, but then +uses the resulting subimages as the small images for a classic mosaic. + +In case the antimosaic image and the input image are the same, +Metapixel will simply reconstruct the input image from the subimages, +because they will always match best in their original locations. To +tell Metapixel to do otherwise, you can use the +--forbid-reconstruction option, which allows you to specify a minimum +distance between the original location of a subimage and the location +it has in the resulting mosaic. + +Here's how you create an antimosaic with a minimum reconstruction +distance of 2: + + metapixel --library images -x input.jpg -f 2 --metapixel input.jpg output.png + + +The Configuration File +---------------------- + +The first thing Metapixel does is try to read the file ".metapixelrc" +in your home directory. From this file, it reads default values for +its settings, so that you don't have to give them on the command line +each time you use Metapixel. + +In this configuration file, you can use the following directives: + + (prepare-directory ) + + The library directory which metapixel-prepare should use by + default. metapixel-prepare does not automatically create the + directory if it doesn't exist, so make sure it does. + + (prepare-dimensions ) + + The size metapixel-prepare should use for the small images. + + (library-directory ) + + A library directory which Metapixel should use when creating + mosaics. You can use this directive more than once. + + (small-image-dimensions ) + + The dimensions of the small images Metapixel should use in + mosaics. + + (yiq-weights ) + + The weights for the channels to be used in matching images. + + (metric ) + + The metric Metapixel should use for matching images. This can + either be "subpixel" or "wavelet". + + (search-method ) + + The search method for creating classic mosaics. This can either + be "local" or "global". + + (minimum-classic-distance ) + + The minimum distance between two occurences of the same image in + classic mosaics with the local search method. + + (minimum-collage-distance ) + + The minimum distance (in pixels) between two occurences of the + same image in collage mosaics. + + (cheat-amount ) + + The cheat amount in percent. + + (forbid-reconstruction-distance ) + + The minimum distance between the position of subimage in the + original image and its position in the output image in an + antimosaic. + +Take a look at the file "metapixelrc" in the distribution. It gives +examples for each of the directives discussed here. + + +Collages +-------- + +To create a collage, you have to use the "--collage" option in +addition to "--metapixel". + +You can also specify a minimum distance between two occurences of the +same image, which is measured in pixels. The default value is 256. +Use the "--distance" option to change it. Note that the distance is +measured between the centers of the images, not their edges, i.e., a +minimum distance of 10 means that the centers of two occurences of the +same image must be at least 10 pixels apart. This will usually mean +that they are allowed to overlap, unless you use very tiny small +images. + +Note that Metapixel uses ridiculous amounts of memory for collage +mosaics. To create a collage photomosaics of size 2048x2048 your +machine should at least have 64MBytes RAM. + + +Protocols +--------- + +Metapixel can, in addition to producing a classical mosaic, write a +file specifying which small images it put in each of the locations. +This protocol file can then be used to reproduce the mosaic without +doing the matching again, for example to experiment with different +cheat amounts. The protocol also contains information on how good +each small image matches the original location, so you can find out +where the matches are good and where they aren't. You can also modify +the protocol and let metapixel generate a mosaic which it wouldn't +have matched itself, for whatever reason you might want to do this. + +Use the --out option to create a protocol and the --in option to +reproduce a mosaic from a protocol. The protocol file is a LISP list +with the following syntax: + + (mosaic (size ) (metapixels . )) + + and are the number of small images in the mosaic +across the width and height of the mosaic, respectively. is +a list containing lists with the following syntax: + + ( ) + + and are the position of the small image. The upper left small +image has coordinates (0,0), the lower right (-1,-1). + and must both be 1 in this version of Metapixel. is +the name of the small image file. + +A typical line in the protocol file looks like this: + + (30 23 1 1 "semiharmless.new/wallpaper07.jpg.png") ; 4792.000000 + +The number at the end of the line is the matching score. The lower +the score, the better the match. Note that the semicolon ';' +introduces a comment which lasts ends with the end of the line, so the +matching score is not part of the protocol syntax. + + +The matching algorithms +----------------------- + +The algorithm that does the image matching via wavelets is described +in the paper 'Fast Multiresolution Image Querying' by Charles +E. Jacobs, Adam Finkelstein and David H. Salesin. + +The new subpixel metric is very trivial. I suggest you consult the +source if you are interested in it. The matching function is +subpixel_compare(). + + +Sorting Images by Size or Aspect Ratio +-------------------------------------- + +Metapixel comes with a tool called `metapixel-sizesort' which sorts +images by size or aspect ratio by moving them to directories +containing only files with similar size or aspect ratio. + +An example: Let's say you have thousands of images in /my/images, and +you want them sorted by aspect ratio and placed in /my/sorted/images. +You can do this with this command: + + metapixel-sizesort --ratio=2 /my/images /my/sorted/images + +The option `2' to ratio tells metapixel-sizesort to put all those +images together whose aspect ratios are the same with an accuracy of +two places behind the comma. You might now have (among others) a +directory called /my/sorted/images/ratio_0.79 which contains all +images whose ratio between width and height is about 0.79. + + +Upgrading from versions 0.8/0.9/0.10 +------------------------------------ + +Starting from release 0.11, Metapixel requires that the tables file is +in the same directory as the small images described in that file. If +your configuration is different, all you need to do is to make sure +that all these files are in the same directory. You don't need to +remove the paths in the tables file, as Metapixel does that +automatically. + + +Upgrading from versions 0.6/0.7 +------------------------------- + +The tables file format has changed in Metapixel 0.8, but you don't +need to run 'metapixel-prepare' again. There's a program called +'convert' included in the distribution that does the job. Just tell +it which size your small images are, give it the old tables file on +stdin and it writes the new one on stdout. + +For example, if your small images are 128 pixels wide and 96 pixels +high, go to the directory with the tables file (usually the directory +where the small images are) and do + + convert --width=128 --height=96 tables.mxt + + +Licence and Availability +------------------------ + +Metapixel is free software distributed under the terms of the GPL. +The file `COPYING' contains the text of the license. + +The source of Metapixel is available at the Metapixel homepage at + + http://www.complang.tuwien.ac.at/schani/metapixel/ + +--- +Mark Probst +schani@complang.tuwien.ac.at diff --git a/graphics/metapixel/metapixel.SlackBuild b/graphics/metapixel/metapixel.SlackBuild new file mode 100644 index 000000000000..fc31c46433f8 --- /dev/null +++ b/graphics/metapixel/metapixel.SlackBuild @@ -0,0 +1,78 @@ +#!/bin/sh + +# Slackware build script for metapixel + +# Written by otzy_007 oz@oprod.net + +PRGNAM=metapixel +VERSION=${VERSION:-1.0.2} +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +mkdir -p $PKG/usr/man/man1 + +make MANDIR=$PKG/man LDOPTS="-L/usr/X11R6/lib${LIBDIRSUFFIX}" +make install PREFIX=$PKG/usr MANDIR=$PKG/usr/man + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true +) + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +) + +( cd $PKG + find . -name perllocal.pod \ + -o -name ".packlist" \ + -o -name "*.bs" \ + | xargs rm -f +) + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + COPYING README $CWD/README.SLACKWARE NEWS \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} \ No newline at end of file diff --git a/graphics/metapixel/metapixel.info b/graphics/metapixel/metapixel.info new file mode 100644 index 000000000000..036bc619819a --- /dev/null +++ b/graphics/metapixel/metapixel.info @@ -0,0 +1,10 @@ +PRGNAM="metapixel" +VERSION="1.0.2" +HOMEPAGE="http://www.complang.tuwien.ac.at/schani/metapixel/" +DOWNLOAD="http://www.complang.tuwien.ac.at/schani/metapixel/files/metapixel-1.0.2.tar.gz" +MD5SUM="af5d77d38826756af213a08e3ada9941" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="otzy_007" +EMAIL="oz@oprod.net" +APPROVED="dsomero" diff --git a/graphics/metapixel/slack-desc b/graphics/metapixel/slack-desc new file mode 100644 index 000000000000..ad21afa2c3fe --- /dev/null +++ b/graphics/metapixel/slack-desc @@ -0,0 +1,20 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +metapixel: Metapixel (program for generating photomosaics) +metapixel: +metapixel: It can generate classical photomosaics, in which the source image +metapixel: is viewed as a matrix of equally sized rectangles for each of +metapixel: which a matching image is substitued, as well as collage-style +metapixel: photomosaics, in which rectangular parts of the source image at +metapixel: arbitrary positions (i.e. not aligned to a matrix) are substituted +metapixel: by matching images. +metapixel: +metapixel: Homepage: http://www.complang.tuwien.ac.at/schani/metapixel/ +metapixel: + -- cgit v1.2.3