ImageMagick convert jpx and jpf to jpg (Ubuntu 16) - imagemagick

I want to convert images with format jpx and jpf to jpg on Ubuntu 16.
After some research i found out that it is require jp2 delegate. Right now when i executed command
convert -list configure | grep DELEGATES
i got this
bzlib djvu mpeg fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pango png ps rsvg tiff wmf x xml zlib
How can i install jp2 delegate on my system? Or if any other way to convert jpf and jpx to jpg, Please suggest me.

Updated Answer
I am trying to get this working more simply, but only have a limited understanding of Ubuntu Package Managers. Here is my current, simplest, working solution.
Step 1 - Install OpenJPEG2000 and all the build tools
Install v2.1 of OpenJPEG2000 Ubuntu 16 with:
sudo apt-get remove --purge libopenjp2-7 libopenjp2-7-dev
sudo apt-get install libopenjp2-7 libopenjp2-7-dev
sudo apt-get install build-essential pkg-config
Step 2 - set PKG_CONFIG_PATH
That is good and it is the one ImageMagick needs, however, it seems maybe to be in a different place from where ImageMagick expects it. It is not in /usr/lib nor /usr/local/lib, but rather it is here:
/usr/lib/x86_64-linux-gnu/libopenjp2.so.7
/usr/lib/x86_64-linux-gnu/libopenjp2.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libopenjp3d.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libopenjp2.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libopenjpip.pc
/usr/lib/x86_64-linux-gnu/openjpeg-2.1
/usr/lib/x86_64-linux-gnu/libopenjp2.so.2.1.0
So, set your PKG_CONFIG_PATH
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/lib/x86_64-linux-gnu/pkgconfig
Step 3 - Install and build ImageMagick from source
cd
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar -xzvf Im*gz
cd Image*[0-9]
./configure
make clean
make -j 8
sudo make install
Original Answer - which works but is cumbersome
Well, this was painful to work out but it works! Ubuntu 16 LTS
First, remove any dead versions of ImageMagick installed via apt-get.
sudo apt-get remove --purge imagemagick
Then, make sure you have all the packages you need to build software with:
sudo apt-get install build-essential cmake pkg-config
Next, install JPEG200 library, version 2.1 or better!!!!
cd
wget https://github.com/uclouvain/openjpeg/archive/v2.1.2.tar.gz
gunzip open*gz
tar -xvf open*tar
cd open*2
mkdir build # Out of source builds are preferred
cd build
cmake --prefix=/usr ..
make clean
make -j 8
sudo make install
Now, install ImageMagick:
cd
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
gunzip Image*gz
tar -xvf *agick*tar
cd ImageMagick-7.0.4-6/
./configure --prefix=/usr
make clean
make -j 8
sudo make install
Now test:
identify -list configure | grep DEL
DELEGATES mpeg jpeg openjp2 ps

Related

ImageMagick cannot get file from HTTPS from inside a Docker container

I'm trying to use ImageMagick 7 in a Docker container. However it doesn't install any delegates, though I added libpng-dev. When I try to get an image inside the container from https with this command:
magick https://www.nasa.gov/sites/default/files/thumbnails/image/moon_mosaic.png ./test.png
I get this message:
magick: no decode delegate for this image format `DAT' # error/constitute.c/ReadImage/738.
This doesn't make sense, since it is a PNG image and not a DAT file.
Here my Dockerfile:
FROM debian:bullseye-slim
ARG IM_VERSION="7.1.0-37"
ARG IM_BUILD_FLAGS="--enable-shared --disable-static --without-modules --enable-delegate-build --disable-docs --with-heic=yes"
WORKDIR /app
RUN apt-get update && apt-get install -y wget && \
apt-get install -y build-essential curl libpng-dev && \
wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/${IM_VERSION}.tar.gz && \
tar xzf ${IM_VERSION}.tar.gz && \
rm ${IM_VERSION}.tar.gz && \
apt-get clean && \
apt-get autoremove
WORKDIR /app/ImageMagick-${IM_VERSION}
RUN sh ./configure ${IM_BUILD_FLAGS} && make -j && make install && ldconfig /usr/local/lib/
Here the output from the configure part of building ImageMagick:
configure:
==============================================================================
ImageMagick 7.1.0-37 is configured as follows. Please verify that this
configuration matches your expectations.
Host system type: x86_64-pc-linux-gnu
Build system type: x86_64-pc-linux-gnu
Option Value
------------------------------------------------------------------------------
Shared libraries --enable-shared=yes yes
Static libraries --enable-static=no no
Build utilities --with-utilities=yes yes
Module support --with-modules=no no
GNU ld --with-gnu-ld=yes yes
Quantum depth --with-quantum-depth=16 16
High Dynamic Range Imagery
--enable-hdri=yes yes
Install documentation: no
Memory allocation library:
JEMalloc --with-jemalloc=no no
TCMalloc --with-tcmalloc=no no
UMem --with-umem=no no
Delegate library configuration:
BZLIB --with-bzlib=yes no
Autotrace --with-autotrace=no no
DJVU --with-djvu=yes no
DPS --with-dps=yes no
FFTW --with-fftw=no no
FLIF --with-flif=no no
FlashPIX --with-fpx=yes no
FontConfig --with-fontconfig=yes no
FreeType --with-freetype=yes no
Ghostscript lib --with-gslib=no no
Graphviz --with-gvc=yes no
HEIC --with-heic=yes no
JBIG --with-jbig=yes no
JPEG v1 --with-jpeg=yes no
JPEG XL --with-jxl=no no
LCMS --with-lcms=yes no
LQR --with-lqr=yes no
LTDL --with-ltdl=no no
LZMA --with-lzma=yes no
Magick++ --with-magick-plus-plus=yes yes
OpenEXR --with-openexr=yes no
OpenJP2 --with-openjp2=yes no
PANGO --with-pango=yes no
PERL --with-perl=no no
PNG --with-png=yes no
RAQM --with-raqm=yes no
RAW --with-raw=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes no
WEBP --with-webp=yes no
WMF --with-wmf=no no
X11 --with-x= no
XML --with-xml=yes no
ZIP --with-zip=yes no
ZLIB --with-zlib=yes no
ZSTD --with-zstd=yes no
Delegate program configuration:
GhostPCL None pcl6 (unknown)
GhostXPS None gxps (unknown)
Ghostscript None gs (unknown)
Font configuration:
Apple fonts --with-apple-font-dir=default
Dejavu fonts --with-dejavu-font-dir=default none
Ghostscript fonts --with-gs-font-dir=default none
URW-base35 fonts --with-urw-base35-font-dir=default none
Windows fonts --with-windows-font-dir=default none
X11 configuration:
X_CFLAGS =
X_PRE_LIBS =
X_LIBS =
X_EXTRA_LIBS =
Options used to compile and link:
PREFIX = /usr/local
EXEC-PREFIX = /usr/local
VERSION = 7.1.0-37
CC = gcc
CFLAGS = -fopenmp -Wall -g -O2 -mtune=ivybridge -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CPPFLAGS = -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PCFLAGS =
DEFS = -DHAVE_CONFIG_H
LDFLAGS =
LIBS = -lm -lpthread
CXX = g++
CXXFLAGS = -pthread
FEATURES = DPC HDRI Cipher OpenMP
DELEGATES =
==============================================================================
All delegates seem to be not active.
EDIT: I checked the output again. It seems like it doesn't find libpng
-------------------------------------------------------------
checking for libpng >= 1.0.0... no
-------------------------------------------------------------
I checked the installed version and it is 1.6.37-3
When I use ImageMagick outside of the Docker container it works without problems. I'm not sure what the problem is and why it doesn't configure the delegates. Sadly I can't install ImageMagick 7 with apt.
Try adding pkg-config, and possibly also autoconf, to your prerequisite package list. ImageMagick is considerably better at finding and configuring stuff with those helpers, especially the PNG delegate:
RUN apt-get update && apt-get install -y wget && \
apt-get install -y autoconf pkg-config ...
Actually, the Alpine docker image is brilliant for ImageMagick. It is very current, very small, and includes loads of delegates:
docker run --rm -it -v "$(pwd)":/work -w /work alpine:latest
/work # apk add --no-cache imagemagick
...
... output, output, output
... and then around 4 seconds later
...
/work # magick identify -version
Version: ImageMagick 7.1.0-50 beta Q16-HDRI x86_64 20489 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib cairo fontconfig freetype gslib heic jng jpeg jxl lcms ltdl lzma png ps rsvg tiff webp x xml zlib
Compiler: gcc (11.2)

OpenCV with libav for codecs on Amazon EC2 AMI

We have an application that requires opencv in a recent version with pkg-config visibility and shared libraries to build. However, the Amazon EC2 AMI instances we are deploying on does not include the yum packages for codecs nor the opencv package.
Other pages describe how to use centOS og rpm packages to get to a working installation. We need a clean install with no yum/rpm cross over.
These steps are most likely one of the shorter paths to the target. Starting directory location is irrelevant as first line ensures a sane (~/build) initial working directory:
cd ~/ && mkdir build && cd build/
sudo yum install git cmake gcc-c++
Build libav for the codecs (the --prefix option is probably not necessary, but this is the tested and working version)
wget https://libav.org/releases/libav-12.3.tar.xz
tar xzf libav-12.3.tar.gz
mkdir libav-12.3-build && cd libav-12.3-build
/home/ec2-user/build/libav-12.3/configure --prefix=/usr --enable-shared --disable-static
make && sudo make install
The amazon default pkg-config thing-a-magic does not look at all standard paths so the next lines symlinks the relevant *.pc files to a location where pkg-config (used by opencv) can find them.
cd /usr/share/pkgconfig
for t in `find /usr -name "libav*.pc"`; do sudo ln -s $t .; done
cd ~/build
The libav shared libraries have to be available to the linker as well
echo /usr/lib/ > libav.conf
sudo mv libav.conf /etc/ld.so.conf.d/
sudo ldconfig
Check the pkg-config libav availability by the command pkg-config --list-all and check that the libavcodec, libavformat, libav... etc. packages are listed.
At this point the opencv library can be built and installed with the default tooling
git clone https://github.com/Itseez/opencv.git
mv opencv opencv.git
cd opencv.git/
git branch -r
git checkout 3.4
cd .. && mkdir opencv && cd opencv
cmake ../opencv.git/ && make && sudo make install
cd ..
The final binary requires the linker path to contain the '''/usr/local/lib64''' path.
echo /usr/local/lib64 > opencv.conf
sudo mv opencv.conf /etc/ld.so.conf.d/
sudo ldconfig
The last trick is to enable pkg-config for opencv as well
cd /usr/share/pkg-config && ln -s `find /usr/local/ -name "opencv.pc"` . && cd ~/build
Check the pkg-config availability by the command
pkg-config --list-all
and check that opencv is listed.
Done

Can ejabberd be installed on Google Compute Engine?

Can ejabberd be installed on Google Compute Engine? Will there be any issues with using ejabberd on Compute Engine? I have looked but cannot find any references to anyone trying this before. Grateful for any help.
Yes. Compute Engine gives you VMs. You can put whatever you want on them, such as Erlang and ejabberd.
Yes you can.
You can use the Vm with Debian Image and follow this intructions.
http://www.howtoforge.com/virtual-mail-jabber-server-xmpp-with-iredmail-and-ejabberd-on-ubuntu-9.10
dont forget open the ports in the firewall.
Sorry I didn't have much time to put together a cleaner "how to". I just copied and pasted from my personal archive.
Here's what you'd have to do to compile the source code on a Compute Engine. Please let me know if you have any questions.
Image: debian-7-wheezy-v20140408
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libncurses5-dev
sudo apt-get install openssl libssl-dev
sudo apt-get install libexpat1-dev
sudo apt-get install unixodbc-dev
wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
tar tar -xvzf yaml-0.1.5.tar.gz
cd yaml-0.1.5
./configure
sudo make
sudo make install
sudo apt-get install xsltproc
sudo apt-get install fop
cd ..
wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz
gunzip -c otp_src_R16B03-1.tar.gz | tar -xf -
cd o....
./configure --with-odbc=/usr/lib/odbc
sudo make
sudo make install
[.. Install git and clone repo here.. ]
git clone git#github.com:processone/ejabberd.git
cd ejabberd
./configure --enable-odbc --enable-mysql
sudo make
sudo make install

How to build a kivy application using buildozer and the latest kivy?

Using buildozer I have successfully built and run an Android application.
Buildozer uses kivy-stable (1.7)
How do I build a kivy application using the latest kivy 1.8 ?
I noticed at
https://github.com/kivy/python-for-android/blob/master/recipes/kivy/recipe.sh the lines
VERSION_kivy=${VERSION_kivy:-stable}
URL_kivy=https://github.com/kivy/kivy/zipball/$VERSION_kivy/kivy-$VERSION_kivy.zip
Does this mean that only the kivy-stable version can be used with buildozer ?
Thanks
I can't remember if buildozer has a switch to use kivy master (1.8 is unreleased), but you can certainly make it work. Here's a few instructions assuming your shell is something bash-like.
First, create your own local kivy repository:
git clone https://github.com/kivy/kivy.git
Second, export the environment variable P4A_kivy_DIR to point at this directory. If this variable exists, python-for-android (including the one downloaded and used by buildozer) will use that directory to build kivy.
export P4A_kivy_DIR="$PWD/kivy$
echo $P4A_kivy_DIR
The second line should print out the directory of your newly cloned kivy.
You can then run buildozer. You might need to first delete the .buildozer file in your app dir, or more specifically some of the python-for-android components - easiest is just to do
rm -rf /path/to/your/app/.buildozer/android/platform/python-for-android
After that, just run buildozer and the python-for-android component should use your copy of kivy master.
If you want this behaviour to automatically work every time, you could put the export line in your .bashrc or some other suitable shell setup file. If you don't do this, you'll need to run the export line every time you create or replace a .buildozer directory.
Now (as on January, 2020) there is an easier option: just specify version in buildozer.spec, e.g.:
requirements = python3,kivy==2.0.0rc1
Google Colab!!!
go to this website: https://colab.research.google.com/
Step 1 : Create a new Note Book
Step 2 : add a new code
Step 3:add your main python file and kv file
Note: Make sure that your notebook is connected to runtime
Step 4:Copy and paste these codes in spreate code cells
!pip install buildozer
.
!pip install cython==0.29.19
.
!sudo apt-get install -y \
python3-pip \
build-essential \
git \
python3 \
python3-dev \
ffmpeg \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libportmidi-dev \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
.
!sudo apt-get install -y \
libgstreamer1.0 \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good
.
!sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libncursesw5-dev libffi-dev uuid-dev libffi6
.
!sudo apt-get install libffi-dev
.
!buildozer init
.
Make sure to rename your python file as main.py
and also upload all the images used in the programe(if used)
navigate to builder.spec file
uncomment and comment these following lines
add __version__ = 0.1 at the top of your main.py
Then
add these Code
!sudo apt install build-essential autoconf libtool
.
pip install --user -U colorama
.
pip install libtool
.
pip install testcase-automaker
.
pip install autoconf
Finally
add this code ...
This will build the apk
!buildozer -v android debug
This Worked for me
Hope this will work for all
Basically - you specify build related things in your buildozer.spec file.
Detailed how to - available on project page:
https://buildozer.readthedocs.io/en/latest/quickstart.html#init-and-build-for-android
In buildozer.spec you can define:
Requirements needed to build/ compile your project like:
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements =python3,kivy,kivymd==0.104.2,pillow==9.1.0,sqlite3
You shouldn't forget about Android permissions if needed for example:
# (list) Permissions
android.permissions =
READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
Last thing in the specs is to define architecture for compiled file. For example:
# (int) Target Android API, should be as high as possible.
android.api = 30
And:
# (list) The Android archs to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.archs = armeabi-v7a, x86
Then terminal command to buildozer to compile:
$ buildozer -v android debug
You will end up with *.apk file that can be used on physical device (copy to the device, grant permissions to the file on the physical device) or in Android emulator (i.e. GenyMotion -> https://www.geeksforgeeks.org/how-to-set-up-an-emulator-for-vscode/).
If any troubles in build or live debugging you can connect to the emulator with adb, like:
$ adb logcat YOUR_DEVICE_IP > log.txt

imageMagick installation problems

I have installed imageMagick but i get a warning loaded PHP Startup. How can i solve this?
[root#vps06 /]# identify -version
Version: ImageMagick 6.8.1-10 2013-07-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jng jp2 jpeg lcms png ps tiff x zli
[root#vps06 /]# php -m | grep imagick
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libfftw3.so.3: cannot open shared object file: No such file or directory in Unknown on line 0
You'll need to install the imagick module for PHP. The easiest way would be with the PECL command.
sudo pecl install imagick
You can also manually install this package if you need more control of your local build
curl -O http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxvf imagick-3.1.0RC2.tgz && cd imagick-3.1.0RC2.tgz
phpize
./configure # Add custom build options here
make
sudo make install

Resources