Posts Tagged ‘images’

Fixing image corruption in Git

Tuesday, August 4th, 2015 | Programming, Tech

You may find that all the images you commit to a git repo are corrupting. This is especially true if you are using Windows and then pushing to a Linux origin.

One possible fix is to ensure the images are being treated as binary files. Of course everything is a binary file when it comes down to it, but this differentiates it from text. To do this, add the following lines to a .gitattributes file in the root of the repo.

*.jpg binary
*.png binary
*.gif binary

If you have images in there already, you will probably need to remove them and then re-commit them.

Search Google with an image

Monday, September 1st, 2014 | Tech

I was dragging an image from my desktop into a folder when it happened to pass over my browser with Google open on it. Suddenly, Google suggested that I might want to search the web using the image.

How well it works is debatable, but it is certainly interesting.

For example, if I upload the image I use as my avatar I get a series of pages that that image is used on. It also shows me visually similar images, but none of them are me.

visually-similar-images

I can see that finding where an image has been used can be useful. Not sure about the similar images though. However, it works better if you use a photo of a celebrity. It identifies the person and then tries to find relevant pages.

britney-spears-search

The image I uploaded was just called 11.jpg and doesn’t have much metadata, so it is quite impressive that it worked all that out from the image.

ImageMagick, Apache and Debian

Thursday, June 7th, 2012 | Life, Tech

Following on from my previous post about installing ImageMagick from source, to get it working with Apache you need to do the following. First, we need to install something from Pecl. So make sure you have the pecl command at hand – if not, install it.

apt-get install pear

Then run the following.

apt-get install php5-dev
pecl install imagick

Finally, add the extension to your php.ini.

extension=imagick.so

Compiling ImageMagick from source on Debian

Friday, June 1st, 2012 | Life, Tech

There is an RPM available for ImageMagick on Debian, but it isn’t the most update to date, so if you need all the new features, you’ll need to compile and install it from source. Luckily, it’s very easy to do.

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd 
./configure
make
make install
make check

Installing PNG support for Debian

Saturday, May 26th, 2012 | Life, Tech

Following on from my recent post about adding JPEG support, I also needed to add PNG support. I couldn’t get the RPM’s to work, so I had to do this manually as well.

wget http://downloads.sourceforge.net/project/libpng/00-libpng-stable/1.2.39/libpng-1.2.39.tar.gz?use_mirror=kent
tar -zxvf libpng-1.2.39
cd libpng-1.2.39/scripts
cp makefile.linux ../makefile
cd ../
make
make install

Installing JPEG support on Debian

Monday, May 21st, 2012 | Life, Tech

If you have made the mistake I did of doing a fairly minimal install on Debian, you might have noticed it is missing a few fairly basic features – such as JPEG support! Luckily it’s fairly easy to install it.

wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --enable-shared
make
make install

HTML image tag

Sunday, September 16th, 2007 | Programming, Tech

Images can be embedded in a page using only one tag. There are examples of images on this page – the top header secton contains three images.

The basic syntax is as follows.

<img src="location.gif" width="300" height="100" border="0" alt="Description text">

For a basic image tag all you need is <img src=”location.gif” alt=”description”>. If you do this the image will display at its normal size although it is always a good idea to add a width and height tag.

The alt property defines the text that is displayed when the image is missing, it is displayed where the image should be. An example is shown below.

<img src="fakelocation.gif" width="200" height="100" alt="Here is an example">

Would produce:

Here is an example

To add a link round an image simply do it like a normal hyperlink

<a href="targetpage.html"><img src="location.gif" border="0></a>