Converseen, a GUI batch image converter and resizer using Qt4 and ImageMagick

I normally use ImageMagick on the command line to convert and/or resize my photographs, and the two commands I use are convert and mogrify. However, I learned recently of Converseen, a GUI tool for batch conversion and resizing of image files which is a front-end for ImageMagick. Although it’s easy enough to use the command line, a GUI tool does save having to remember the command syntax each time, so I thought I’d install Converseen in Gentoo. Converseen is not in the main Portage tree, but I found an ebuild for version 0.2 from the qting-edge overlay. However, rather than add the overlay I decided instead to use a local overlay to install Converseen, which is currently at version 0.4.1, and the procedure I used is given below.

1. I downloaded to ~/Desktop/ the ebuild file from http://gitorious.org/gentoo-qt/qting-edge/blobs/master/media-gfx/converseen/converseen-0.2.ebuild and renamed it as converseen-0.4.1.ebuild, which contains the following:

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

LANGSLONG="it_IT pl_PL"

inherit qt4-edge

MY_P=${PN}-${PV}

DESCRIPTION="GUI image conversion tool based on imagemagick"
HOMEPAGE="http://converseen.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug"

DEPEND="x11-libs/qt-gui:4
|| ( media-gfx/graphicsmagick[imagemagick] media-gfx/imagemagick )"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_P}"

DOCS="README"

src_prepare() {
qt4-edge_src_prepare

sed -i -e "s!/usr/lib!/usr/$(get_libdir)!" ${PN}.pro \
|| die "sed libdir failed"

local ts_files=
for lingua in ${LINGUAS}; do
for a in ${LANGSLONG}; do
if [[ ${lingua} == ${a%_*} ]]; then
ts_files="${ts_files} loc/${PN}_${a}.ts"
fi
done
done
local qm_files="${ts_files/.ts/.qm}"

sed -e '/^ loc/d' \
-e "s!\(TRANSLATIONS += \).*!\1${ts_files}!" \
-e "s!\(translations\.files = \).*!\1${qm_files}!" \
-i ${PN}.pro || die "sed translations failed"
}

2. I downloaded to ~/Desktop/ the file qt4-edge.eclass, which contains the following:

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: qt4-edge.eclass
# @MAINTAINER:
# Ben de Groot ,
# Markos Chandras ,
# Davide Pesavento ,
# Dominik Kapusta
# @BLURB: Experimental eclass for Qt4 packages
# @DESCRIPTION:
# This eclass contains various functions that may be useful when
# dealing with packages using Qt4 libraries. Requires EAPI=2.

inherit base eutils multilib qt4-r2 toolchain-funcs

export XDG_CONFIG_HOME="${T}"

qt4-edge_pkg_setup() {
if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
ewarn
ewarn "Please file bugs on bugs.gentoo.org and prepend the summary with"
ewarn "[qting-edge]. Alternatively, contact qt@gentoo.org."
ewarn "Thank you for using qting-edge overlay."
ewarn
ebeep 5
fi
}

qt4-edge_src_unpack() {
debug-print-function $FUNCNAME "$@"

qt4-r2_src_unpack "$@"
}

# @FUNCTION: qt4-edge_src_prepare
# @DESCRIPTION:
# Default src_prepare function for packages that depend on qt4. If you have to
# override src_prepare in your ebuild, you should call qt4-edge_src_prepare in it,
# otherwise autopatcher will not work!
qt4-edge_src_prepare() {
debug-print-function $FUNCNAME "$@"

qt4-r2_src_prepare
}

# @FUNCTION: qt4-edge_src_configure
# @DESCRIPTION:
# Default src_configure function for packages that depends on qt4. If you have to
# override src_configure in your ebuild, call qt4-edge_src_configure in it.
qt4-edge_src_configure() {
debug-print-function $FUNCNAME "$@"

qt4-r2_src_configure
}

# @FUNCTION: qt4-edge_src_compile
# @DESCRIPTION:
# Default src_compile function for packages that depends on qt4. If you have to
# override src_compile in your ebuild (probably you don't need to), call
# qt4-edge_src_compile in it.
qt4-edge_src_compile() {
debug-print-function $FUNCNAME "$@"

qt4-r2_src_compile
}

# @FUNCTION: qt4-edge_src_install
# @DESCRIPTION:
# Default src_install function for qt4-based packages. Installs compiled code,
# documentation (via DOCS variable) and translations (via LANGS and
# LANGSLONG variables).
qt4-edge_src_install() {
debug-print-function $FUNCNAME "$@"

qt4-r2_src_install

# install translations # hwoarang: Is this valid for every package???
# need to have specified LANGS or LANGSLONG for this to work
[[ -n "${LANGS}" || -n "${LANGSLONG}" ]] && prepare_translations
}

# Internal function
_do_qm() {
debug-print-function $FUNCNAME "$@"
[[ $# -ne 2 ]] && die "$FUNCNAME requires exactly 2 arguments!"

local transfile="$(find "${1}" -type f -name "*${2}".qm)"
if [[ -e ${transfile} ]]; then
INSDESTTREE="/usr/share/${PN}/${1#${S}}" \
doins "${transfile}" \
|| die "failed to install ${2} translation"
else
eerror
eerror "Failed to install ${2} translation. Contact eclass maintainer."
eerror
die "Failed to install translations"
fi
}

# @VARIABLE: TRANSLATIONSDIR
# @DESCRIPTION: Translations directory. If not set, ${S} will be used

# @FUNCTION: prepare_translations
# @DESCRIPTION:
# Choose and install translation files. Normally you don't need to call
# this function directly as it is called from qt4-edge_src_install.
prepare_translations() {
debug-print-function $FUNCNAME "$@"

# Find translations directory
# Changed default to . - crazy upstreams :)
local roottrdir="${TRANSLATIONSDIR:-${S}}" trdir=.
for dir in lang langs translations; do
[[ -d ${roottrdir}/${dir} ]] && trdir="${roottrdir}/${dir}"
done

local lang=
for lang in ${LINGUAS}; do
for x in ${LANGS}; do
[[ ${lang} == ${x%_*} ]] && _do_qm "${trdir}" ${x}
done
for x in ${LANGSLONG}; do
[[ ${lang} == ${x} ]] && _do_qm "${trdir}" ${x}
done
done
}

EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install

3. I synchronised the Portage main tree’s ebuilds on my PC with those in the repositories:

# emerge --sync

4. I made sure that /etc/make.conf has the following lines at the end of the file:

PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage/"
ACCEPT_LICENSE="*"

5. I created the necessary directories in the local overlay:

# mkdir -p /usr/local/portage/media-gfx/converseen
# mkdir -p /usr/local/portage/eclass

6. I made sure Portage would not nag me about a missing name for my local overlay:

# mkdir /usr/local/portage/profiles
# echo "local_overlay" > /usr/local/portage/profiles/repo_name

7. I copied the converseen ebuild and eclass file into the relevant directories:

# cp /home/fitzcarraldo/Desktop/converseen-0.4.1.ebuild /usr/local/portage/media-gfx/converseen/
# cp /home/fitzcarraldo/Desktop/qt4-edge.eclass /usr/local/portage/eclass/

8. I generated the manifest for the package:

# cd /usr/local/portage/media-gfx/converseen/
# ebuild converseen-0.4.1.ebuild manifest

9. I merged the package:

# emerge -1v converseen

An entry for Converseen was added to Kickoff > Applications > Graphics, and I can either use that to launch it or I can launch it from the command line by entering the command converseen. The user interface is easy to master, and I’ve already put Converseen to use at work and at home. Overall, then, a useful addition to my KDE toolkit.

EDIT (July 23, 2012}: There is an ebuild for Converseen in Portage these days, so use that instead to install Converseen.

Follow

Get every new post delivered to your Inbox.

Join 49 other followers