Author Topic: Create a tiff image of any file type?  (Read 13539 times)

0 Members and 2 Guests are viewing this topic.

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Create a tiff image of any file type?
« on: April 07, 2010, 01:19:17 pm »
I've been writing various revisions of an application that I use at work on a regular basis. The application's purpose is to convert any file type to a tiff image. In other words, create a tiff image of that file.

Originally, I used the Windows Imaging Printer Driver, or whatever it is called. It's the built in Windows printer driver that converts what you print to an image output file. This does tiff, and it was fast. The problem with this was that it was finicky. The application has to run in the background and require no user intervention. The Windows Imaging printer would often error out and I don't think it was able to convert "anything" to an output image.

I looked for toolkit solutions that I could use with C# and that wouldn't require an external printer driver. I found one toolkit, but it didn't support a wide range of file types - lacked Visio, most notably. I believe the lack of file type support is because it doesn't require Office to print, so they're somehow imeplementing their own print rendering methods for each type, or however that works. I didn't find many others that looked professional enough to use.

I went back to the printer driver solution, but this time found a printer driver written for my exact purpose. It can take most any input that I've tried, so far, and converts it to an output image. It still relies on host applications to provide the print feature, but can supposedly be fed raw file data and determine how to render it on it's own. I've tried this and haven't been able to get it to print anything, yet. It just enters and leaves the print spool.

Anyways, I'm just wondering if anyone knows of a toolkit that can essentially do this. I know I could just as easily use Adobe to convert anything to a PDF, but TIFF is a standard we have to follow.
http://www.chyea.org/ - web based markup debugger

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: Create a tiff image of any file type?
« Reply #1 on: April 07, 2010, 01:28:01 pm »
ImageMagick :D

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: Create a tiff image of any file type?
« Reply #2 on: April 07, 2010, 01:44:51 pm »
I've seen that before, and I think it only does mostly image to image converstions. Like png to tiff.
http://www.chyea.org/ - web based markup debugger

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Create a tiff image of any file type?
« Reply #3 on: April 07, 2010, 01:48:58 pm »
I'm pretty sure ImageMagick can do PDF => TIFF:

^_^[@rhubarb][~][1006][Wed Apr 07, 11:48:27]
$ ll WALKING_CATFISH.*
-rw------- 1 mullins under 137K 2010-03-13 00:25 WALKING_CATFISH.pdf

^_^[@rhubarb][~][1007][Wed Apr 07, 11:48:28]
$ convert WALKING_CATFISH.pdf WALKING_CATFISH.tiff; ll WALKING_CATFISH.*
-rw------- 1 mullins under 137K 2010-03-13 00:25 WALKING_CATFISH.pdf
-rw------- 1 mullins under 6.5M 2010-04-07 11:48 WALKING_CATFISH.tiff


I have no clue why I have that file...

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: Create a tiff image of any file type?
« Reply #4 on: April 08, 2010, 07:35:56 pm »
^ ugliest console prompt ever lol.

anyways, image magick only works for image file types. not things like word, excel, etc. i may have to mix and match a bunch of crap together.

on a different note, ive found a completely undocumented function in Microsoft's Office Interop dll for Excel in C#. cant even figure out how to properly call it based on the params, and the VB documentation for something similar. =(
http://www.chyea.org/ - web based markup debugger

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Create a tiff image of any file type?
« Reply #5 on: April 08, 2010, 07:44:41 pm »
You said you could "just as easily have Adobe convert everything to PDF".  This is a trivial additional step.

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: Create a tiff image of any file type?
« Reply #6 on: April 08, 2010, 09:35:05 pm »
If you can go to pdf first, you can use ABCpdf from WebSuperGoo to convert a lot of formats to PDF.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: Create a tiff image of any file type?
« Reply #7 on: April 09, 2010, 10:31:28 am »
You said you could "just as easily have Adobe convert everything to PDF".  This is a trivial additional step.

Yea, the step is trivial but include it in a process that involves converting 800GB of files to TIFF. That's going to like double the amount of time it takes. Basically, when I said that, I was just acknowledging the fact that I had already thought about the Everything -> PDF -> TIFF process and dismissed it.

There are plenty of projects that do individual file types to TIFF. I'm just going to have to continue integrating them all into my project. I was just hoping that somebody had possibly done exactly what I'm doing already.
http://www.chyea.org/ - web based markup debugger

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Create a tiff image of any file type?
« Reply #8 on: April 09, 2010, 12:17:43 pm »
You could just do it the way you're doing it right now and add PDF as the uhoh clause.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Create a tiff image of any file type?
« Reply #9 on: April 09, 2010, 01:05:27 pm »
You said you could "just as easily have Adobe convert everything to PDF".  This is a trivial additional step.

Yea, the step is trivial but include it in a process that involves converting 800GB of files to TIFF. That's going to like double the amount of time it takes. Basically, when I said that, I was just acknowledging the fact that I had already thought about the Everything -> PDF -> TIFF process and dismissed it.

There are plenty of projects that do individual file types to TIFF. I'm just going to have to continue integrating them all into my project. I was just hoping that somebody had possibly done exactly what I'm doing already.

Ah.  I guess I didn't understand.

Sorry, then.  Good luck!

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Create a tiff image of any file type?
« Reply #10 on: April 13, 2010, 08:38:51 am »
Code: [Select]
#!/bin/sh

for dir
do
        for img in $dir/*.jpg $dir/*.jpeg $dir/*.png $dir/*.bmp
        do  
                [ ! -f "$img" ] && continue
                tiff=`echo $img | sed 's/\\.[^.]*$/.tiff/'`
                echo "$img -> $tiff"
                convert "$img" "$tiff"
        done
done

./mkeverythingtiff.sh dir1 dir2 dir3 ...

EDIT: Made regex more robust, changed 'break' to 'continue'
« Last Edit: April 13, 2010, 08:46:22 am by nslay »
An adorable giant isopod!

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: Create a tiff image of any file type?
« Reply #11 on: April 13, 2010, 12:26:31 pm »
Yes, that's great for doing image type -> image type conversions. I've had that under control. My main concern was other file types, such and Word and Excel documents -> tiff. I've got those converting to tiff, also, but I was curious if anyone knew of other "all in one" integration tools for this.
http://www.chyea.org/ - web based markup debugger

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Create a tiff image of any file type?
« Reply #12 on: April 13, 2010, 05:17:56 pm »
Yes, that's great for doing image type -> image type conversions. I've had that under control. My main concern was other file types, such and Word and Excel documents -> tiff. I've got those converting to tiff, also, but I was curious if anyone knew of other "all in one" integration tools for this.
ImageMagick can also convert some document formats like pdf or postscript.  Don't use it to convert vector formats to other vector formats though ... it needlessly rasterizes vector images so that you end up with a very large and useless output vector format.

For other formats, basically it boils down to pdf or postscript.  Just print Excel, Word, etc... files to pdf or postscript.
An adorable giant isopod!

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Create a tiff image of any file type?
« Reply #13 on: April 13, 2010, 06:51:07 pm »
Yes, that's great for doing image type -> image type conversions. I've had that under control. My main concern was other file types, such and Word and Excel documents -> tiff. I've got those converting to tiff, also, but I was curious if anyone knew of other "all in one" integration tools for this.
ImageMagick can also convert some document formats like pdf or postscript.  Don't use it to convert vector formats to other vector formats though ... it needlessly rasterizes vector images so that you end up with a very large and useless output vector format.

For other formats, basically it boils down to pdf or postscript.  Just print Excel, Word, etc... files to pdf or postscript.

Someone didn't read some of the other posts. ;)

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Create a tiff image of any file type?
« Reply #14 on: April 13, 2010, 09:05:27 pm »
Hey, why don't you use imagemagick?