Affichage des articles dont le libellé est jpeg. Afficher tous les articles
Affichage des articles dont le libellé est jpeg. Afficher tous les articles

jeudi 12 juillet 2012

Mettre un stamp sur une image

Avec convert (de Imagemagick), fonctionne bien avec la version :

$convert --version
Version: ImageMagick 6.5.7-8 2009-11-26 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP


#!/bin/bash
# stamp timbre A_marquer Img_finale

# (c) 2007-2010 by C.M.
# under the GPL License

# prendre deux fichiers d'images
# l'un étant un "sceau" et l'autre une photo
# et marquer la photo du sceau, en bas à droite (ou gauche)
# Image timbre
SCEAU="$1"
# Image à marquer
PIC="$2"
# Fichier de sortie
OUT_IMAGE="$3"
# Proportion du timbre par rapport à l'image
SCALE="/ 20"
# Texte ajouté sous le timbre
TEXTE=""


# dimensions de l'image à marquer
width_pic=`identify -format %w "$PIC"`
height_pic=`identify -format %h "$PIC"`

# dimensions du sceau
width_sceau=`identify -format %w "$SCEAU"`
height_sceau=`identify -format %h "$SCEAU"`

# dimensions auxquelles réduire le sceau
stamp_w=$(( $width_pic $SCALE * 2))
stamp_h=$(( $height_pic $SCALE))



Nettoyer les metadonnées d'images

j'ai pour cela trouvé jhead :
jhead -purejpg [img.jpg]
jhead is used to display and manipulate data contained in the Exif header of JPEG images from digital cameras. By default, jhead displays the more useful camera settings from the file in a user-friendly for‐ mat. jhead can also be used to manipulate some aspects of the image relating to JPEG and Exif headers, such as changing the internal timestamps, removing the thumbnail, or transferring Exif headers back into edited images after graphical editors deleted the Exif header. jhead can also be used to launch other programs, similar in style to the UNIX find command, but much simpler.

vendredi 14 octobre 2011

CMYK, 300DPI and Linux (Ubuntu)

Wishing to participate in a graphic contest, I had to follow some strict rules:

  • Less than 5MB

  • "CMNJ" which I found is the french for "CMYK colors"

  • JPEG hi-def




It took me some time to find the appropriate tools for Ubuntu Linux, since Gimp was not much help with all that. CMYK seemed to be planned for the Gimp-v3.0, but all I found were comment on this "future release" (I'm now using "GNU Image Manipulation Program version 2.6.11", standard one with Ubuntu...).


DPI problem



I used the XnView tool to reset the DPI to 300.
xnview : (sudo apt-get install xnview was enough to install it !)


I found this tool following what is explained here : http://www.rideau-info.com/photos/changedpi.html.



CMYK problem



First of all, I had never heard about it, so I was gonna assume it was the default format... In French CMYK is called CMJN, and referred as "Quadrichromie" (opposed to "RGB"(en) "RVB"(fr) "trichromie").

Of course, the pictures I had were in RGB, so I had to convert them to CMYK.

I found a tool able to do that easily, coming on the side of the LittleCMS image library : jpegicc !

Hoping my quest was over, I read the doc on how to use it, and found that CMYK needed some "profiles definition". Looking around on the net, I found some distributed by Adobe doing a search on their website "research" tool. I then found a .zip, unpacked it and had RGB and CMYK profiles (~10 differents).



In order to test them, I applied all of them (in the folder "profiles/CMYK_Profiles/" ) to a sample file "test2.jpg" to see the resulting colors :
for i in profiles/CMYK_Profiles/* ; do jpegicc -o"$i" test2.jpg test2.cmyk--`basename "$i"`.jpg ; done


To the lazy ones, the command for a single profile (or to copy-past it) :
jpegicc -oProfile.icc file-In-RGB.jpeg file-Out-CMYK.jpeg


Those were rendering quite different colors at the end, and I said good bye to my white background.