Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98961 invoked from network); 23 Aug 2017 12:42:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2017 12:42:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 74.125.83.46 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 74.125.83.46 mail-pg0-f46.google.com Received: from [74.125.83.46] ([74.125.83.46:33322] helo=mail-pg0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/5D-34801-1487D995 for ; Wed, 23 Aug 2017 08:42:41 -0400 Received: by mail-pg0-f46.google.com with SMTP id t3so57956pgt.0 for ; Wed, 23 Aug 2017 05:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AfWinVK7+H8u0eMMipWUxP0VSGKGLIcO1aSoqG+f5RQ=; b=FRN4exw3THpgGz0pdI67zKBl7TeYXQ/Ywog1yQRT6kiUcgsLNP3+t7ig6m/PEEhRNO wolHNKAW88xZMS29M95Fmbp1kjbg5jkG/uKrsO1hGarOFKfdS1cAjFZJUJysh3PMtS+R GjpeYAZN2sEWDAaOMrT7n+h4K2MkEcqTO4CEk+pYeqR/yCbKLWxr/Z85fH1ltNf3RA7x P5EG68s2+mgBxAAxI2BJQoFIw0KCz/6/LY00OHtBNehyQHU/psflpkikc3gs9D9Fw59R e5cBMTsj/qwffjZP+dft0Pc69pFH0wJWLd39uPj4wRu1yqm5B1FGdFQaK1siDMA0hFsO otUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AfWinVK7+H8u0eMMipWUxP0VSGKGLIcO1aSoqG+f5RQ=; b=qguYthbZPeuhDrLy3JrbncTSIbMyFFgG5Ig5JZhTPTpdvcUO+P+hdT621CrSse/XEV 0SdZZKB9wsRLVQ1PUAij9dJjKveUBsWW4NVIvw1y4tzsJK0EgR0b+Y0H/Kv/yFnj8Y6s H/64gDHQZ+hxmHL3C5/Vle0QcFWj8p8G4LOLCr/X4s0VOkuJm4l6ppGLcaLQrpsUZn9r /kmh7STZa7IHYp5Pxf57zaMIZLEr7PEktXNBQQgq0xApwLt/lHOWTrNdakOftVc4ILOE LrY+OzZPcIrXg0QQNksia+n8zTddZWZy/x3IKMbzssQHk5eklirWOMcB4cSTDSgMuhHz QSCQ== X-Gm-Message-State: AHYfb5g9+kFJ9JOhZqZYyK+wiv3kCeOKnyhoK5LdVI5pHWZYgLIzXfGe hZc0HrupUu2uKSfKQKXScH3BITjsI4R6 X-Received: by 10.99.36.65 with SMTP id k62mr2541435pgk.23.1503492158359; Wed, 23 Aug 2017 05:42:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.148.164 with HTTP; Wed, 23 Aug 2017 05:42:37 -0700 (PDT) In-Reply-To: References: Date: Wed, 23 Aug 2017 14:42:37 +0200 Message-ID: To: Pierre Joye Cc: PHP internals Content-Type: multipart/alternative; boundary="94eb2c04a94a05c4e605576b0cf9" Subject: Re: [PHP-DEV] GD vs Imagick From: rasmus@mindplay.dk (Rasmus Schultz) --94eb2c04a94a05c4e605576b0cf9 Content-Type: text/plain; charset="UTF-8" Thank you all for considering the subject and contributing your thoughts. I understand why Imagick is not attractive as a standard module (even according to the maintainer) since we can't feasible bundle all it's dependencies, so I suppose that's a no-go. The libvips module does in deed look interesting. I suppose this would have all the same problems though? Lots of dependencies. So GD wins perhaps mostly because it's small and has fewer dependencies. Color profiles in my experience are pretty common though - and currently (silently) leads to mangled images with GD. I've seen a work-around, as somebody mentioned, which involves parsing the binary contents of JPEG files, extracting the color profile and injecting it into a JPEG file after GD has saved it - this is (A) horrible in terms of memory and CPU usage, and (B) not what most users are going to want in the first place; you most likely want color profiles moved, which is better in terms of browser compatibility and performance when delivering images over the web. So this is not a good work-around. I wanted to contribute to Intervention Image - a library that abstracts GD and Imagick behind a common API, but it turns out, this can't be implemented with GD in PHP, except of course resorting to approaches like pixel-by-pixel manipulation, for which PHP is totally unsuitable. Ideally, I think that GD should be fixed, since it's the default (by which I mean, it's the only option on a standard PHP install) so that libraries like Intervention Image can deliver predictable results. I'm not a C developer though, so I can't help with that. On Thu, Aug 17, 2017 at 7:03 AM, Pierre Joye wrote: > hi Rasmus, > > On Tue, Aug 15, 2017 at 5:52 PM, Rasmus Schultz > wrote: > > The following GD issue is all-too common: > > > > https://stackoverflow.com/questions/5773032/how-to-stop- > gd2-from-washing-away-the-colors-upon-resizing-images > > > > Basically anyone who's ever accepted uploaded images and resized or > > converted them, has bumped into this. > > > > Only Imagick makes it possible to work around this issue, it's not > possible > > with GD, at all - and the internal behavior of GD is arguably "wrong", as > > the visible output of simply opening and saving a JPEG image with GD is > > mangled with washed-out colors. > > > > I am starting to wonder why GD is the default in PHP? > > > > It's a pretty outdated library with a clunky API - we have Imagick with a > > much more concise API and a ton more useful features. > > I disagree here, as old functions are old fashioned, new ones are easy > to understand and to use. Not OO, but that's a little details (contrib > welcome). And I disagree with outdated as well. It is focused on > easiness and most common usages. More features make it depending on > the requests or available time to actually add them. Performance wise > it is also similar to similar actions. > > > Why is the less-capable image library the default on the PHP platform? > Why > > not Imagick? > > Imagick is good, but it is a huge library, by its size, features, code > base (external) and complexity. I would never ever recommend to have > it bundled or even less by default. > > In any cases, both libraries (or the bindings) welcome contributors, > you are more than welcome too :) > > Cheers, > -- > Pierre > > @pierrejoye | http://www.libgd.org > --94eb2c04a94a05c4e605576b0cf9--