I have a Remote Administration Tool and was necessary change for 64 bits plattform. I have used Zlib for compress and decompress memorystreams, but after do this change, Zlib classes showed several errors when I tried compile my project in 64 bits plattform, because Zlib only is avaiable for 32 bits plattform.
Then,I had that search on internet for some similar classes for make compress and decompress of memorystreams and I found this question where discussion is about LZMA class that also can make like I need, similar to Zlib class.
And I understood the advice:
The big issue that you will face is that the library you have chosen to use requires you to know how large the file is that you are decompressing.
So, I'm here exactly for know some suggestion for try solve this trouble.
In others words, I want know how decompress exactly the size of memorystream that is received by Server side of my project?
Any opinion or suggestion here is welcome.
OK, it looks like you're using ZLibEX, by Roberto Della Pasqua, Borland:
https://github.com/senjaxus/Delphi_Remote_Access_PC/blob/master/Fontes%20Access%20PC%20-%20Delphi%207/Cliente/ZLIBEX.pas
You're correct - the assembly portion MoveI32 is non-portable.
BUT ...
You should be able to use the same API in your current Delphi XE-5 from System.Zlib:
http://docwiki.embarcadero.com/Libraries/XE5/en/System.ZLib
http://delphiblog.twodesk.com/native-zip-file-support-in-delphi-xe2
http://docwiki.embarcadero.com/CodeExamples/Seattle/en/ZLibCompressDecompress_%28Delphi%29
Related
For quite some time now there have been several image codecs which provide significant improvements over PNG and JPG, however the latter still remain dominant.
Two formats in particular that I'd really like to see getting more adoption are FLIF and BPG. They seem superior in every possible way to JPG and PNG (except for lacking market acceptance). Especially FLIF seems extremely promising.
TL;DR = Besides supporting them in my own software, is there a way to get FLIF and BPG support in imagemagick?
The ChangeLog for ImageMagick says
2015-06-25 6.9.1-7 ... * Support BPG image format
There's no direct BPG support in the ImageMagick source code, but config/delegates.xml lists delegates "bpgdec" and "bpgenc" which convert BPG files to and from PNG files which then get processed by ImageMagick. You would have to supply those delegates if they aren't already on your system. You can download the sources for bpgdec and bpgenc from
http://bellard.org/bpg/
There's nothing about FLIF in the ChangeLog, but a "pull request" for FLIF support was recently applied, and coders/flif.c exists in the ImageMagick sources (it requires a separate libflif to work). You can download the source code for libflif from https://github.com/FLIF-hub/FLIF
I haven't tested either feature.
bpgdec, bpgen, and libflif are all LGPL-licensed, and a reduced version of bpgdec is available under a BSD license.
To get imagicmagick to work with .bpg you have to compile it separate from what is already there. In other words, you have to add it in. So download the source code and it doesn't compile. Give up and use something else or try this because I got it to work
use apt-get and install
libpng*
libsdl1*
libsdl2*
libsdl-image*
cmake
libjpeg*
and maybe libjpg*
decompress the .bpg files you downloaded and just
use the command
make and sudo make install
AFTER that imagemagick will work with libpg and will not give an error of a missing delegate..
I'd like to use LibTiff with XE3 to access image meta data information from TIFF files.
I need to find the number of pages inside tiff and their sizes.
I suggested LibTiff because I need the fastest possible implementation of reading tiff image meta data.
The only link I have found is not working anymore:
http://www.awaresystems.be/imaging/tiff/delphi.html
OK, Internet Archive has returned back to operational state, and here is your download:
LibTiffDelphi, full version. Large download (approx 1.39 megabyte), includes Debug and Release versions
Well, the download links at that site do appear to be down. You could try downloading from here instead: http://www.vdebris.comli.com/wp-content/uploads/2009/09/libtiffdelphi_3_9_1.rar
I think you could use Mike Lischke's GraphicEx to solve your problem. The TImageProperties record that is made available by the TGraphicExGraphic class appears to have what you need.
found that code working with *.tif and used graphics + lib for solution building TIF SPLITTER
not sure if it helps to solve your problem
i have tried to open some JPEG files in Delphi with TImage component. i also added the Jpeg unit. i can open most of jpg files and there is no problem.
but when i try to open some JPGs, the program just throw an exception.
i also tried to load that images in design mode, but there is some problem. in design mode the exception is:
Access violation at address 402672A1 in module 'vcljpeg70.bpl'. Write of address 08E84000
Why i cannot open that JPGs? they are not corrupted. i checked them in some tools like savantools EXIF viewer.
here is the URL of one of that images:
http://xs842.xs.to/xs842/09340/backpic435.jpg
Thanks so much
PS:
My Delphi version is 7. Borland Delphi 7
The reason you may be encountering this problem is due to the file type. Delphi has issues displaying JPEG images that have been encoded using CMYK, rather than the default RGB encoding. CMYK is a format that is generally used for Print design, try and always encode your images to RGB format to avoid this issue with Delphi.
Patch for Delphi jpeg.dcu
Bye.
Interesting. Neither Internet Explorer nor Google Chrome will display that JPEG image you linked to. I do not get 404 Not Found errors, I simply get an image placeholder, indicating that the image could not be opened/displayed correctly.
FireFox does display the image.
Are you certain that there is not something fishy, or at least slightly unusual, about the JPG files involved?
UPDATE: The file linked to in the question opens in PaintShop Pro (an old version 6.0 installation) - if I then simply re-save as a Standard Encoding JPEG, IE and Chrome both display the newly saved image as I'd expect. There would definitely appear to be something a bit "odd-ball" about the encoding of the original JPEG that some JPEG apps can handle but not all, including some "major players", not just Delphi. :)
Check out the Free Image library for alternative JPEG support in Delphi if the native one has problems. Free Image is an open source lib that lets you work with JPEG/PNG/... from Delphi/BCB/and others. Very nice library IMHO.
http://freeimage.sourceforge.net/
I've looked at the file with a hex editor, and found 3 JFIF headers. After extracting each part, I found 2 thumbnails and an image. Nothing special, because embedded thumbnails seem to be part of the EXIF2 standard.
The thumbnails themselves load fine in Delphi, and converting the file to something readable can be done with almost every piece of software that I've tried.
Anyway, this page will give you very detailed information about the picture, and what headers are inside (just paste the url of your image in the textbox):
http://www.monster-submit.com/resources/jpeganalyzer/
I get the same error. This appears to be a bug in Delphi's JPEG lib. You should report it to QC.
SimDesign's NativeJpg can open that file. It's a JPEG library written entirely in Delphi, and the author has been good about adding support for new extensions and color spaces when we've run into them. In addition to a TGraphic descendant for TImage support it exposes lots of lower-level interfaces for manipulating JPEGs, though I haven't used them.
The RIM compiler performs extra optimization and compression on the resulting ".jar" while building the final .cod file, but there are things that can be done by the developer to significantly reduce the final .cod file size.
One such thing would be to run PNGCrush, OptiPNG, or a similar tool to reduce the size of the included .png files. In an application with a large number of image files (such as an app featuring a custom UI), this can yield a significant reduction in the final .cod file size.
How can I optimize the final .cod file for size? Something to be done in the .java code itself? Something to be done in the project structure? Something to be done to the files or resources?
Good question!
Compression (GZip, ZLib) may be useful when installing large bin/txt/xml files
And that's what they say in RIM:
Setting appropriate access
Avoid creating interfaces
Use static inner classes
Avoid unnecessary field initialization
Import individual classes
Also, interesting facts:
All images was PNG format. I want to
know why : compile with JDE 4.5 -->
900k, compile JDE 4.2, 2.6.1, 4.7 -->
1800k. What is difference ? Thanks !
Seems that JDE 4.5 uses more optimization techniques than older JDE
versions.
Check the image below, it produced by PngOut from 55 K png image. It's size is 3427 bytes
I think you most certainly want to consider a shrinker (and optimizer/obfusticator) like ProGuard (http://sourceforge.net/projects/proguard/). This can shrink your Java code by collapsing full class names into shortened versions, removing unused code, etc. Along the way it can improve the efficiency of the code. It's great. The only hard part is modifying your build to optimize the generated class files before the RIM build stuff gets its hands on it to make a .cod.
A good approach is to GZIP all resources and then use net.rim.device.api.compress.GZIPInputStream class to load compressed files. That way you don't have to implement decompress code by yourself.
Also you can use pngout for optimizing image resources.
Make sure that you use PNG-8 instead of PNG-24 when possible. Try to minimize number of colors in palette. After this, use PngOut.
As for ProGuard, I have problems on old BB devices when using optimize feachure of Progruard ("-dontoptimize" switch) - so use it carefully, although it is a great tool.
I'm developing a BlackBerry application in which I need to unpack a zip file compressed with PKZIP. The package could have one file in it, or it could have 10; it will vary in each case. I know that the BlackBerry API has native support for GZip and Zlib, although I'm pretty sure that these methods aren't going to be helpful in my case. It doesn't look as if I can extract the individual files using these calls.
I've tried JZlib (http://www.jcraft.com/jzlib/), which compiled fine, but again it doesn't look as if the methods contained therein are going to allow me to pull the individual files.
It appears as if this is possible, as there's an application called Ziplorer (http://www.s4bb.com/software/ziplorer/) that claims to do perform this exact procedure. How they're doing it, however, escapes me.
So here I am after hours of Googling. I'm welcoming any insight into my problem with open arms.
"zip" algorithms are typically offshoots of the Lempel-Ziv-Welch algorithm. They are a fairly efficient stream compression algorithms, but because of how they function, you can't start to decompress at random points in the file, you have to start from the start.
Any product that claims to be able to decompress one file from a zip still has to decompress everything before it in the zip file in order to know how to decrypt the given file, or even, for that matter, where the file is in the archive.
If you can tolerate GPL code in your application, then this library http://jazzme.sourceforge.net/ that might work. However the project (and its parent project http://sourceforge.net/projects/jazzlib/) don't look like they're being developed.