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

0 Members and 1 Guest 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?

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Create a tiff image of any file type?
« Reply #15 on: April 13, 2010, 09:14:20 pm »
Hey, why don't you use imagemagick?
* Sidoh punches iago

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Create a tiff image of any file type?
« Reply #16 on: April 14, 2010, 01:08:41 am »
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. ;)
I read other posts.  I emphasized that you really have no choice for non-image formats except to print them to postscript or pdf ... not that ImageMagick could or could not convert pdf to tiff.  Someone didn't read other posts carefully.

P.S. Printing systems such as CUPS invoke ghostscript in the background and do deal with postscript implicitly ... hence the word "print" as opposed to "using Adobe to convert them to PDF".  So anything that is printable, that isn't an image, can be converted to tiff by way of ImageMagick.  Again, not the same as "I'm pretty sure ImageMagick can do PDF".
« Last Edit: April 14, 2010, 01:13:40 am by nslay »
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 #17 on: April 14, 2010, 01:15:14 am »
I read other posts.  I emphasized that you really have no choice for non-image formats except to print them to postscript or pdf ... not that ImageMagick could or could not convert pdf to tiff.  Someone didn't read other posts carefully.

warz said a few times that he's already considered going from X -> pdf/ps -> tiff, and that it's an unacceptable solution because the files he's converting are huge.  He's also said he's encountered some software that uses printer drivers (as most X -> pdf/ps applications do) to do X -> tiff, and that he was wondering if anyone had had previous experience with similar software.

That's why I said that.  Everything you said had already been considered.  I'm not complaining.  I'm just saying I don't think the solution you provided will work for warz for reasons he's already mentioned.

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Create a tiff image of any file type?
« Reply #18 on: April 14, 2010, 01:36:32 am »
I read other posts.  I emphasized that you really have no choice for non-image formats except to print them to postscript or pdf ... not that ImageMagick could or could not convert pdf to tiff.  Someone didn't read other posts carefully.

warz said a few times that he's already considered going from X -> pdf/ps -> tiff, and that it's an unacceptable solution because the files he's converting are huge.  He's also said he's encountered some software that uses printer drivers (as most X -> pdf/ps applications do) to do X -> tiff, and that he was wondering if anyone had had previous experience with similar software.
Too bad.  He wants an image from a non-image format.  The corresponding programs usually only deliver graphic output through the print system so he doesn't really have a choice does he?
Quote
That's why I said that.  Everything you said had already been considered.  I'm not complaining.  I'm just saying I don't think the solution you provided will work for warz for reasons he's already mentioned.
Not really, because you didn't mention he didn't really have a choice.  I suppose he could find/write a tiff printer driver (would probably convert to tiff from an intermediate format anyways).  I mean, he has to go through the print system for non-image formats ... only those programs understand how to generate graphical outputs for those non-image formats and most of them deliver that output through the print system.  Too bad ... it sucks, but there you go.
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 #19 on: April 14, 2010, 01:42:27 am »
Too bad.  He wants an image from a non-image format.  The corresponding programs usually only deliver graphic output through the print system so he doesn't really have a choice does he?

Not really, because you didn't mention he didn't really have a choice.  I suppose he could find/write a tiff printer driver (would probably convert to tiff from an intermediate format anyways).  I mean, he has to go through the print system for non-image formats ... only those programs understand how to generate graphical outputs for those non-image formats and most of them deliver that output through the print system.  Too bad ... it sucks, but there you go.

He seems to suggest that he's found an exception to the "usually" ...?  It wasn't just me, FYI.  I didn't respond to say "I ALREADY SAID THAT JERK"... was just saying that your proposed solution didn't match the criteria he had provided.  Also, you didn't say "you don't have a choice".  You just suggested X -> ps/pdf -> tiff like everyone else had.  If you were meaning to "emphasize" the fact that he was stuck, you didn't do a very good job. ;)

If that's true, then it sounds like he's SOL... he seemed to suggest otherwise, and that he was just looking for someone who'd dealt with the problem before.

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Create a tiff image of any file type?
« Reply #20 on: April 14, 2010, 01:48:14 am »
Too bad.  He wants an image from a non-image format.  The corresponding programs usually only deliver graphic output through the print system so he doesn't really have a choice does he?

Not really, because you didn't mention he didn't really have a choice.  I suppose he could find/write a tiff printer driver (would probably convert to tiff from an intermediate format anyways).  I mean, he has to go through the print system for non-image formats ... only those programs understand how to generate graphical outputs for those non-image formats and most of them deliver that output through the print system.  Too bad ... it sucks, but there you go.

He seems to suggest that he's found an exception to the "usually" ...?  It wasn't just me, FYI.  I didn't respond to say "I ALREADY SAID THAT JERK"... was just saying that your proposed solution didn't match the criteria he had provided.  Also, you didn't say "you don't have a choice".  You just suggested X -> ps/pdf -> tiff like everyone else had.  If you were meaning to "emphasize" the fact that he was stuck, you didn't do a very good job. ;)

If that's true, then it sounds like he's SOL... he seemed to suggest otherwise, and that he was just looking for someone who'd dealt with the problem before.

I'm sorry.  I'm just in a bad mood.

The best he can do is a tiff printer driver (and they are all over Google).  The only program that understands how to render a non-image format is that program itself and it usually exports that through the print system.  I don't see how you can avoid printing aside of writing your own reader that can render the non-image format.
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 #21 on: April 14, 2010, 01:53:03 am »
Aah, okay.  Seems like pretty good evidence of being screwed, then. :)

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: Create a tiff image of any file type?
« Reply #22 on: April 23, 2010, 07:31:11 pm »
Too bad.  He wants an image from a non-image format.  The corresponding programs usually only deliver graphic output through the print system so he doesn't really have a choice does he?

Nope, not accurate. I have found one toolkit that does do Word, Excel and PowerPoint to TIFF without using a printer driver. It does conversions without even requiring Office or a printer. I have no clue how it works, but I know that it does work. So, I do have a choice.

He seems to suggest that he's found an exception to the "usually" ...?  It wasn't just me, FYI.  I didn't respond to say "I ALREADY SAID THAT JERK"... was just saying that your proposed solution didn't match the criteria he had provided.  Also, you didn't say "you don't have a choice".  You just suggested X -> ps/pdf -> tiff like everyone else had.  If you were meaning to "emphasize" the fact that he was stuck, you didn't do a very good job. ;)

If that's true, then it sounds like he's SOL... he seemed to suggest otherwise, and that he was just looking for someone who'd dealt with the problem before.

Correct.

The best he can do is a tiff printer driver (and they are all over Google).  The only program that understands how to render a non-image format is that program itself and it usually exports that through the print system.  I don't see how you can avoid printing aside of writing your own reader that can render the non-image format.

Nope.

Aah, okay.  Seems like pretty good evidence of being screwed, then. :)

Nope. :P
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 #23 on: April 30, 2010, 12:08:12 am »
Hmm... what nslay said made sense to me, but that's probably because I don't know much about how printer drivers work.  It seemed to indicate that everything goes to postscript anyway, so at some level, you're still converting from postscript.

I guess I misunderstood. :)