How to add load from and save to file support for binary/depth=1/bilevel image in FileIO of julia? - file-io

Objective:
To save a bi-level image to file as Array{Gray{Bool},2}, but not of type Array{Gray{Normed{UInt8,8}},2}.
It is understood from https://github.com/JuliaIO/FileIO.jl, that new formats for loading from and saving to file can be defined. I am new to image processing.
Please guide me in adding binary image format to FileIO to load from and save to file.

Related

Generation pdf truncated

I have to transform a HTML badly built in PDF.
I transformed the HTML file into XTML with the class Tidy.
Then, generated my PDF with XMLWorkerHelper.
It's work but the generated PDF is not correct.
The images are missing and the text is truncated on certain files.
What specific configuration may I use to solve this problem?
It is the first time when I use these class and it's not easy.
Thanks for your help
I have files html badly constituted to transform into PDF.
I thus used at first Tidy to format them in XHTML and then XMLWorkerHelper to generate the pdf.
I've used itextpdf-5.4.2 xmlworker-5.4.2 .
PdfWriter writer = PdfWriter.getInstance(documentPDF, new FileOutputStream(pdfFilename));
documentPDF.open();
XMLWorkerHelper.getInstance().parseXHtml(writer, documentPDF, new FileInputStream(HTMLFileName));
I can't post my file, it's too big.

Showing pdf file in dhtmlxTabbar

How to load a pdf file for viewing in a dhtmlxTabbar? I tried attachObject, but it doesn’t work
You need attachURL method:
tabbar.tabs("t1").attachURL("../__docs/LR1160_US.pdf");

How do I load an LCR image from my server using AlamofireImage?

I'm trying to load an LCR image for use as a collection view cell image using AlamofireImage but nothing is showing up.
cell.imageView.af_setImageWithURL(NSURL(string: "http://www.example.com/MY_LCR_IMAGE.lcr")!)
If I use https://placehold.it/500x500 as the URL string (a PNG), it works. And the same LCR file, loads fine in my TVML/TVJS app. So I know the problem is not the LCR file or generally with how I'm attempting to load the image using af_setImageWithURL.
I'm guessing that I need to support the correct MIME type for an LCR image. When I check the MIME type of my LCR file, it is application/octet-stream. The AlamofireImage documentation says:
If the image you are attempting to download is an invalid MIME type
not in the list, you can add custom acceptable content types using the
addAcceptableImageContentTypes extension on the Request type.
So I've included the following line before I attempt to call af_setImageWithURL.
Request.addAcceptableImageContentTypes(["application/octet-stream"])
I still end up with no images.
There was a bug in AlamofireImage that it wasn't using the acceptableImageContentTypes for af_setImageWithURL. AlamofireImage 2.2.0 fixes that.

Stream to File in WinRT

How i can save a Stream to File in WinRT. Currently i am working on a Open Source library for creating PDF file in windows 8. I build the stream with pdf content, now my requirement is to save this stream to file. Can anyone please guide me to solve this issue.
I assume you're working with C#? One way to do it would be to read the stream content using DataReader and store it into a byte[] buffer. After that you can create the file like this:
var file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("filename", Windows.Storage.CreationCollisionOption.ReplaceExisting);
await Windows.Storage.FileIO.WriteBytesAsync(file, buffer);
Then again, if you already have to byte data for the pdf, you can skip making it a stream in the first place.
Hope this helped.

Detecting corrupted jpg files before or during upload

I have an ASP application that uses ASPImage.Image to resize the uploaded image and then save the file to the server and save it in the database. However, it appears that if a user uploads a corrupted file the resulting image is blank white image.
I need a way to check if the file is corrupted before the image is passed to ASPImage.Image, that will then inform the user that the file is corrupted.
Can this be done with javascript, vbscript or ASPImage.Image itself?
Any assistance would be greatly appreciated.
Best Regards,
Paul Jacobs
There is no way to detect a corrupt image in either javascript or vbscript - you will need to try using ASPImage.Image directly.
It has an Error property, this will probably have an error detailing that a corrupt file has been loaded - did you try that? That is, if it is populated, chances are that the file was corrupt.
Additionally, the LoadImage method returns a boolean - I assume it will return false if the image couldn't be loaded due to corruption.
You can use the code here: http://forums.aspfree.com/code-bank-54/pure-asp-upload-script-with-additional-features-94647.html
Then check the image Width and Height - if 0 it means the uploaded file was not a valid image.
This is pure classic ASP code without third party components.