Silent Archimedes

Archive for the ‘Linux’ Category

Problem: Maximum number of files in NTFS in Ubuntu

Posted by silentarchimedes on March 12, 2009

So I do a lot of image processing in my work, and I ran into a problem today that I still haven’t found a logical answer to:

On my Ubuntu 8.10 computer, I have a 1TB internal harddrive /dev/sdc1 mounted in NTFS format. After the initial format, My max volume size is stated as 931.51GiB. On this drive, I have lots of folders, and many of them have thousands (1K to 6K) of small images, in formats of jpg, png, ppm. Today, one of my scripts crapped out when it tried to create a new image and returned “Operation not supported.”

Even when I used touch or a simple vi created file, I could not create any more files. The current disk usage on the harddrive is:

Contents: 704,324 items, totalling 826.3 GB

And Ubuntu tells me I still have 102.5 GiB of space left. So I started thinking if I’ve reached my inodes limit because of the number of files. However, when I do a ‘df -i‘, I am no where near the limit:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdc1            108159004  706236 107452768    1% /media/sdc1

When I look online, all the documentation and search says that the maximum number of files in NTFS is 2^32-1. The only other thing is the master file table (MFT) and how it might increase it’s size if more files get created beyond those specified in MFT. However, I haven’t been able to confirm this.

Anybody have an explanation for this? It’s really bugging me that it’s happening and I can’t figure it out.

Posted in Computers, Linux, Technology | Tagged: , , , , , , , , , , , | 3 Comments »

DBP, mogrify, convert – How to batch crop, resize, rename, format convert images in Ubuntu

Posted by silentarchimedes on March 11, 2009

DBP – David’s Batch Processor for GIMP

If you want to do this in the context of GIMP, download and install DBP (David’s Batch Processor). It will show up as an option under the Filters menu list. Just click ‘Batch Process’ and a GUI will pop up. You simple add files to the input list and you can do various basic image processing operations on it. They include any combinations of rotate, blur, colorize, resize, crop, sharpen, rename and image format conversion.

One drawback to DBP is that it does not allow you to add a directory or directories instead of a list of individual images. For some people that need to batch process directories of images, you will have to either manually do a directory one at a time or temporarily put all your images into one directory. This is a bit of a pain.

mogrify or convert – ImageMagick tools for Linux

If you are more of a command line guy or if you do need to batch process directories of images, mogrify or convert is the way to go. The man page of mogrify states, ‘mogrify – resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more. Mogrify overwrites the original image file, whereas, convert(1) writes to  a  different image file.’

You can simply put a bunch of mogrify commands into a script file and let it run in the background. An example mogrify command to resize all your jpegs to 256×256 looks like:

  mogrify -resize 256x256 *.jpg

An example convert command to resize all your jpegs to 256x256 gifs with a prefix of images looks like:

  convert -size 256x256 *.jpg images%0d.gif

Look  at the ImageMagick’s mogrify page or convert page for more info. Speaking of, if you don’t have ImageMagick installed on your Ubuntu system, you should. 🙂

What if you want to command line convert images and put them in another directory, but keep the same names as the original images?

So at first it seemed like convert was the way to go since mogrify is supposedly only for modifying the original images in place. However, convert‘s way of doing it requires a bit of linux scripting. There is a easier in mogrify. It  has an option -path that allows you to specify an output image path.

In the following command, I want to crop out a 320×480 subimage beginning at location (160,0) in all the ppms in the tempim directory. I want the processed images to have the same names as the originals but to put them in the tempim2 directory:

mogrify -path tempim2 -format png -size 640×480 -extract 320×480+160+0 tempim/*.ppm

Posted in Computers, Linux, Technology | Tagged: , , , , , , , , , , , , , , , | 7 Comments »