Photoshop PSD thumbnailer for Gnome file manager

This script generates a system script and associated meta-information for displaying Adobe Photoshop .PSD image thumbnails in Gnome file manager. It is intended to work with Nautilus, but also works with Nemo in Linux Mint 18.2 Sonya Cinnamon, even though “Add GConf Hooks” section of the script fails.

Run the script with sudo and reboot afterwards.

The script was acquired from askubuntu.com here, and it is actually preferable that you get it from there, because here it may be automatically reformatted and fail at execution. It is posted here only for archival purposes.


#!/bin/bash

# ———————————————————–
# — Write psdthumbnailer
# ———————————————————–
OUTFILE=/usr/lib/psdthumbnailer
(
sudo cat <<‘EOF’ # bin/bash # Arguments / Parameters %i %o %s f_in=$1 f_out=$2 f_size=$3 # Execute Convert PSD to PNG through ImageMagick exec convert “psd:$f_in[0]” -scale “$f_sizex$f_size” “png:$f_out” EOF ) > $OUTFILE
# ———————————————————–
# — Write photoshop.thumbnailer
# ———————————————————–
OUTFILE=/usr/share/thumbnailers/photoshop.thumbnailer
(
sudo cat <<‘EOF’ # bin/bash [Thumbnailer Entry] TryExec=/usr/lib/psdthumbnailer Exec=/usr/lib/psdthumbnailer %i %o %s MimeType=image/vnd.adobe.photoshop; image/x-photoshop; image/x-psd; EOF ) > $OUTFILE
# ———————————————————–
# — Set File Permissions
# ———————————————————–
sudo chmod 0755 /usr/lib/psdthumbnailer
sudo chmod 0644 /usr/share/thumbnailers/photoshop.thumbnailer

# ———————————————————–
# — Add GConf Hooks to parse thumbnails
# ———————————————————–
sudo gconftool-2 –set /desktop/gnome/thumbnailers/image@vnd.adobe.photoshop/enable –type bool true

sudo gconftool-2 –set /desktop/gnome/thumbnailers/image@vnd.adobe.photoshop/command –type string “/usr/lib/psdthumbnailer %i %o %s %i %o %s”

# ———————————————————–
# — Install Dependencies
# ———————————————————–

sudo apt-get install imagemagick

Advertisements

List fonts used in PDF document

If you want to see what fonts have been used in creation of a PDF document, you can use pdffonts utility of poppler-utils package for this. Just type:

  • pdffonts yourfile.pdf

Generate QR code

  • This simple command will give you an SVG file with QR code vector image in it:
echo "Hello world!" | qrencode --level=H --dpi=300 --type=SVG -o qr.svg
  • If a bitmap is enough, just type:
echo "Hello world!" | qrencode --level=H --dpi=300  -o qr.png

  • Even this simple command will work:
qrencode -o qr.png "Hi!"

  • Change the color from standard black to any if you like:
echo "Hello world!" | qrencode --foreground=808080ff --level=H --dpi=300 --type=SVG -o qr.svg
  • Alpha supported too:
echo "Hello world!" | qrencode --foreground=FFFF00FF --background=0000FF55 --level=H --dpi=300 -o qr.png
echo "Hello world!" | qrencode --foreground=FFFF00FF --background=0000FF55 --level=H --dpi=300 --type=SVG -o qr.svg

		

Add custom emblems in Linux Mint Mate

You can make and assign your very own Gnome emblems to files and directories in Linux Mint Mate ( Tested on Mint 18 ).

  • Go to Home folder
  • Select from menu Edit -> Backgrounds and Emblems…
  • Choose Emblems
  • Add a New Emblem…
  • Enter the Keyword
  • Click Image to select image file

You can add any custom image of whatever size, as it gets rescaled as needed.

Still you may want to use one of the standard sizes (16×16, 22×22, 24×24, 32×32, 48×48, 96×96) and save it as a PNG file in a location of your choice.

Try to start with the image size of 24×24. You may use one of the existing emblem files for reference, for example /usr/share/icons/Mint-X/emblems/24/emblem-favorite.png .
 


Removing line breaks from base64 encoded data

You may experience a weird problem, when you attempt to embed base64 encoded TTF font file in a Web page with CSS @font-face and the font just does not work. You try decompressing the base64 data, and get perfectly valid TTF file. Everything is fine, but nothing works.

Well, the problem is caused by line breaks in the base64 encoded data. It is said that those line breaks are there because once upon a time software could not handle long strings. Well, these days it is obviously the opposite. Web browsers seem unable to handle base64 data with line breaks SOMETIMES, because base64 encoded images work perfectly well even if there are the breaks. The fonts don’t though.

Whatever. Take your base64 encoded file and run this command on the command line:

tr -d "\n\r" < Font.base64 > Font-valid.base64


Add image to MP3

You can add album art images to your mp3 files. Use EasyTAG (GUI) or eyed3 (CLI) ID3 tag editors to accomplish that.

Example. Use eyed3 to remove any embedded images, then list options for embedded image file, then embed an image for an icon:

  • eyeD3 --remove-images test.mp3
  • eyeD3 --list-image-types
  • eyeD3 --add-image=test.jpg:ICON test.mp3

LibreCAD icon for Linux Mint Mate

LibreCAD icon, PNG, 48×48 pixels, for use with Linux Mint Mate panel, matching Mint-Y theme icons.

As such an icon was not included in the distribution a custom one had to be made.

LibreCAD icon, PNG, 48x48 pixels

LibreCAD icon, PNG, 48×48 pixels