How to convert CorelDraw .WI wavelet-compressed image - image-processing

I have a large sample of .WI images I need to convert to e.g. JPEGs, but the format now seems defunct.
The mimetype is image/wavelet.
The compression algorithm was developed by Summus, a US company that also now seems defunct.
The last CorelDraw support for the format was under 32-bit Windows. If I go down the hardware route I need to be able to make calls to a server via e.g. REST.
I think under *nix djvulibre might be able to open the files, but I haven't been able to test this yet.
Another option is to re-implement the codec myself.
It would be a nice-have to be able to script this.
Here's an example file http://www.wolfgang-rolke.de/graphics/wavelet.wi

Related

Opening a TIFF File from the Web Browser

I checked previous questions here on SO but I think I want my functionality to work a little different. I understand that .tif files are not natively supported in Internet Explorer and that an extension, such as AlternaTIFF, are available to remedy this. However, I would like the dialog to show up where the user can either save/open the file on the client side. I know that MS Windows Picture and Fax Viewer can open them, no problems.
The files are located on our servers and this will be an intranet site. Currently, I have a link to the files populate in the view but again, I'd like that option for the user to Save/Open the file.
I'm using MVC, which I'm a little unfamiliar with, and can't seem to figure this one out. Thank you.
You can do an action that returns a tiff by changing the headers so when someone clicks the link the file will get downloaded or using FileResult.
Example with FileResult (i find it easier): http://www.dotnetcurry.com/ShowArticle.aspx?ID=807
For saving them is just like uploading any file with MVC. This post can be useful http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
My advice is that you convert them to .jpg or .png when uploaded using GDI+.
//You first upload the tiff to the server like the post above explains
//And then open and convert it to .JPEG
Bitmap bm = Bitmap.FromFile("mypic.tiff");
bm.Save("mypic.jpg",ImageFormat.JPEG);
And if you already have the urls of all the tiffs, you can always do a console app to convert all of them. Even if you need to use tiffs its a good idea to have .jpg versions to show on the web. You can even resize them to create previews and save some bandwith too! :-)

How to convert a string to pdf file in Python without using temp txt-file on HDD?

I have a big library in plain txt-format.
I need to convert these files into pdf format (from inside Python script, not from command-line), but previously I need to make some manipulations on the original files' text.
I'm just reading the files' content into string, make the needed changes, and then I want to output the changed string into pdf-file, but without creating temporary text file on HDD.
Is there any way to do that?
Thanks in advance.
P.S. BTW, the library is in Russian, so I suppose I'll need to take care of encodings?
use the ReportLab toolkit: http://www.reportlab.com/software/opensource/rl-toolkit/
(it is also on PyPi: pip install reportlab; or if you are running Linux use the package manager)
The default built-in fonts of PDF do not support Russian, so you will have to do something
like:
canvas.setFont('DejaVuSans',10)
(replace 'DejaVuSans' with an installed font name you know has your characters in it).
This will incorporate that font in your PDF and make the resulting file about 20K bigger than without.
It is also possible to generate the PDF to memory, if that is necessary.

optimze pdf file size in rails app

For a rails app that works a lot with uploaded image heavy pdf files I'm looking for a way to optimize the file size of uploaded pdf's.
Adobe Acrobat has a 'save as reduced file size pdf' option which often halves the filesize when images are included.
I would like to do a similar action that is triggered after a file upload in my rails app.
Any ideas?
While #lzap's comment may be true, if you still want to give it a shot, you might look at pdftk (PDF Toolkit). Its a library for manipulating and creating PDF files that looks like it offers the ability to compress a given pdf file.
The library can be installed on most major operating systems, so if you have the ability to install it on your host, then simply call:
system("pdftk uncompressed-input.pdf output compressed-outpu.pdf compress")
inside your rails app whenever you want to compress a particular PDF file. I have no idea how long this would take, and if you are compressing many PDF's at the same time, you may want to consider handing off to a background job (without this, Rails will wait until the compression is done before returning anything to the browser, probably causing a timeout error for long running groups of compression calls).
Also, if your file names come from user input, be extra careful to avoid injection attacks.

Customizable / Dynamic SWF generation

Wondered if anybody knows how customizable Flash swf files are made, where there appears to be a template swf that the user can then input some changes (eg text or image) and receives a newly-compiled swf file with their changes.
Some examples:
- http://flashfreezer.com/landingconfetti/index.html
Constraints:
- user receives a single output swf file that can be played with all their changes included. ie there is no reading from an xml file, or using Flashvars.
Been trying different things for a few weeks with no luck!
There are a number of ways, but generally the most common is to either use a SWF generating library (like PHP's) or through server-side compiling.
Normally, this will be a custom or proprietary library which uses the same language that the serve is running (and there are open-source libraries for this in PHP, Perl, Python, Java, C++... etc). The SWF is generated and served up with the appropriate headers so that the browser knows how to re-direct it. Often this will involve a pre-defined template which is then modified slightly for the new input. Only occasionally does this involve the manipulation of pre-generated SWF directly.
The other option is to have a command line call to the Flash IDE or the Flex compiler (and, technically, this can work for CS3 and CS4, though in a very nasty and hackish way) to generate a new version of the SWF on the fly. This is often slower, but it will generally yield a more finished feel to a product.
You could try Swiffotron. It can modify SWF files and do text replace type things on both text elements and in compiled actionscript.
Here's a swiffotron xml job file that does some text replacing.
And here's a swiffotron XML job file that modifies instances on the stage.
I didn't check the site, but the only way I can think of is to read the requirement details through flash (this can be done through plain html also) and then generate the AS files from their templates and compile them at the server side (using mxmlc or other compilers) and give back the SWF.
I get the impression that you're looking for SwfMill. SwfMill creates a swf based on an XML file that you create/define. You could use SwfMill on the server to generate a swf based on user input.

Search Words in pdf files

Is it possible to search "words" in pdf files with delphi?
I have code with which I can search in many others files like (exe, dll, txt) but it doesn't work with pdf files.
It depends on the structure of the specific PDF.
If the pdf is made of images (scanned pages) then you have to OCR each image and build a full text index inside the PDF. (To see if its image based, open it with notepad and look for obj tags full of random chars). There are a few utilities and apps that do this kind of work for you, CVision PDF Compressor is one that I have used before.
If the pdf is a standard PDF, then you should be able to open it like any other text file and search for the words.
Here is page that will detail some of the structure of a PDF. This a SO post for the same.
The components/libraries mentioned in the answer to this question should do what you need.
I'm just working on a project that does this. The method I use is to convert the PDF file to plain text (with pdftotext.exe) and create an index on the resulting text. We do the same with word and other office files, works pretty good!
Searching directly into pdf files from Delphi (without external app) is more difficult I think. If you find anything, please update here as I would also be very interested in that!
One option I have used is to use Microsoft's ifilter technology, this is used by windows desktop search and many other products such as sharepoint and SQL server full-text search.
It supports almost any office/office-like file format, even dwg, msg, pdf, and files in zip/rar archives.
The easiest way to use it is to run FiltDump.exe on any files you have, and index the text output.
To know about the filters installed on your PC, you can use ifilter explorer.
Wikipedia has some links on its ifilters page.
Quick PDF Library's GetPageText function can give you the words from a PDF as well as the page number and the co-ordinates of those words - sometimes useful for highlighting.
PDF is not just a binary representation. Think of it as a tree of objects, where an object node has some metadata and some content information. Some of these objects have string data, some don't. Some of these are even encrypted, and some are compressed. So, there's very little chance your string finder will work on any arbitrary PDF.

Resources