Comments (5)
So. Imagick uses the ImageMagick library underneath through the MagickWand API. ImageMagick also has command line tools, which mostly expose the same functionality, however.....
ImageMagick has different expectations for users. The command line tools will normally try to guess the right behaviour, whereas with the API it will do exactly as told, which can be annoying.
Also, not all of the functionality available in the command line tools of ImageMagick are exposed 'neatly' for re-use through an API.
Is there any way to translate the Examples from https://imagemagick.org/script/ into PHP code?
It's reasonably fine to just run those scripts through exec or one of the other ways of running stuff on the command line.
In general there should be an equavalent call to the class Imagick - or not?
Usually, but not always.
But convex hulls should be possible through the morphology method
That code is meant to give a convex hull output similar to the example on ImageMagick.
However it doesn't appear to be doing the right thing. I'll need to investigate if I'm just misremembering, or it's borken.
from imagickdemos.
Yeah, the output of the link above is meant to be:
But apparently the output is wrong when building against the current version of Imagick. I'll investigate tomorrow.
from imagickdemos.
Oh. The code works.....but the server is timing out, and so keeps displaying the previous image on the page. Which is a different problem, but that is some code that convex hulls stuff.
from imagickdemos.
Thank you very much for your quick reply!
Probably I have the same timeout problem here. I get blank or the original images when deskewing and cropping photos. That's my overall goal. Either with convexHull or with deskew() + trim(). it's all the same - whichever is better.
I start as follows:
$fname = "6947"; # you can see 6947 below this code
$src = "files/test/$fname.jpg";
$imagick = new \Imagick();
$imagick->readImage(TL_ROOT . '/' . $src);
$html .= $this->ImgToHtml($src, $imagick, "Original");
$imagick->despeckleImage();
This is my source from the scanner:
It should be deskewed in the first step with the following code - this does not work on any server:
$src = "files/test/$fname.deskew.jpg";
#$imagick->setImageBackgroundColor(new ImagickPixel("rgb(254,254,254)"));
$result = $imagick->deskewImage(0);
$imagick->writeImage(TL_ROOT . '/' . $src);
$html .= $this->ImgToHtml($src, $imagick, "deskew: 0");
The result is:
You can see here, deskew is not working (with any parameter from zero to 100)
In the next step i try to trim/autocrop the image with the following code.
$src = "files/test/$fname.trim1.jpg";
#$imagick->setImageBackgroundColor(new ImagickPixel("rgb(254,254,254)"));
$fuzz = 60000;
$result = $imagick->trimImage($fuzz);
$imagick->writeImage(TL_ROOT . '/' . $src);
$html .= $this->ImgToHtml($src, $imagick, "trim1 fuzz: $fuzz");
The fuzz parameter is not well documented. I can't find any detailed information on how it works exactly.
For the previous image, trimImage() happens to work with the value 60000, but this is not true for all my images (3500), and there seems to be no documentation or algorithm that I can use to calculate the fuzz parameter so that it performs an exact trim on arbitrary images.
At the moment it seems that deskew and trim/autocrop do not work with IMagick 7.1.0.18? Is this true?
Or am I making a serious mistake here?
Best regards
Theo
from imagickdemos.
ping
from imagickdemos.
Related Issues (20)
- logo tshirt is broken HOT 1
- eyeColorResolution is coming back in wrong colour space? HOT 1
- measure error is an option
- Style Italic is not working.
- every example I tested is broken on www.phpimagick.com HOT 6
- AVIF compression not working ?
- a tutorial for "new Imagick()" and constructors for the other types in the navigation bar HOT 6
- setImageMatteColor looks broken
- addKernel is also broken... HOT 1
- Imagick::setImageMatte needs checking against valgrind.
- Document imagemagick security evaluator.
- image HOT 2
- convolveImage shows no image
- imagick for PHP 8.2 HOT 9
- Deskew image not showing HOT 1
- Imagick::unsharpMaskImage page error HOT 1
- Can't install via pecl on php 8.3
- How to install ImageMagick / Imagick on AlmaLinux 9 with PHP 8.1
- Support for cannyEdgeImage HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagickdemos.