基于php的Photoeffects网站 [英] Photoeffects site based on php

查看:125
本文介绍了基于php的Photoeffects网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道



虽然这个例子相当简单,相同的逻辑适用于更复杂的作品。


  1. 您需要从高分辨率图像开始。特别是如果您将为用户提供实物照片。

  2. 高分辨率也是非常必要的,因为您必须事先在Photoshop等程序中进行编辑和准备。

  3. 为获得最佳效果,这些将需要Photoshop中复杂的复合遮罩。认为锐利而平滑的alpha转换。不要只是用强硬的线条剪掉所有的东西。

在考虑上面的例子时,您只能使用一层在Photoshop中。只需剪下一个放置照片的地方,然后导出为 png



对于其他示例,我会推荐单独的背景和前景图层,用户添加的图像夹在中间。





这是分辨率最重要的另一个很好的例子。叶子太小,无法以微小的分辨率有效遮挡。有些叶子也可能模糊不清,再次,不要用强硬的线条切断它们。为了获得最佳效果,请在Photoshop中使用柔软的笔刷进行遮盖。



最后但并非最不重要的一点,这里有一个非常简单的动手实例。
$ b



很难。坦率地说,部分叶片没有关注,可以进一步细化。您在这里投入的时间将使您的最终结果有多么令人信服。



将每个图层保存为 png ,并在 php 内复合。我会建议确保每个 png 具有相同的尺寸。不要试图将一个小的 png 放在一个较大的一个上。给他们相同的尺寸,使对齐变得轻而易举。


I want to know how websites like http://photofunia.com/ and other online photo effects sites are built. For example, using php, i want merge two images frame.png with profile.jpg. I want my frame.png transparent in the center where I would place my profile.jpg.

I have tried this, but it doesn't work:

<?php $dest = imagecreatefromjpeg('dest.jpg');
      $src = imagecreatefrompng('logo.png');
      $src = imagerotate($src, 90, imageColorAllocateAlpha($src, 0, 0, 0, 127));
      $almostblack = imagecolorallocate($src,254,254,254); 
      $src =  imagecolortransparent($src,$almostblack); 
      imagealphablending($dest, true);
      imagesavealpha($dest, 0);
      imagecopymerge($dest, $src, 900,600, 1, 1, 90,90, 90); 

Thanks in advance. Please help me.

解决方案

You've received a more technical answer already so I'm going to focus on the creative aspect of things. You've also mentioned familiarity with the associated php libraries and even previous attempts to create similar compositions that seemed to lack luster in the end.

In my opinion, this endeavor is far more reliant on artistry, creativity and, most importantly, prepared assets. By manually preparing these images you will have more finesse over the final result as well as leave only the simple compositing to php. Not the entire editing process.

Frankly, such detailed results are not achievable via an API. This project will require hours of manual labor and editing. Paying attention to lighting, transparency and colors.

The most impressive effects are the ones where objects in the photo overlap the user-added image. Ie:

While this example is rather simple, the same logic applies to more complex compositions.

  1. You need to start with a high resolution image. Especially if you will be offering physical prints to your users.
  2. The high resolution is also quite necessary as you will have to edit and prep these in a program like Photoshop beforehand.
  3. For best results these will require complex, compound masks in Photoshop. Think sharp and smooth alpha transitions. Don't just cut everything with hard lines.

When considering the example above, you would be able to get away with only one layer in photoshop. Simply cut a hole where photos will be placed and export as png.

For other examples I would recommend separate background and foreground layers, with the user-added image sandwiched in between.

This is another great example where resolution is of utmost importance. The leaves are way too small to be effectively masked out at a tiny resolution. Some of the leaves may also be blurred and out of focus; again, don't cut them with hard lines. For best results, use a soft brush when masking them in Photoshop.

And last but not least, here's a very simple hands-on example.

Note how the background image has a smooth mask while the leaf has a hard one. Frankly, parts of the leaf are out of focus and can be further refined. The investment of time you make here will make the world of difference in how convincing your final results are.

Save out each layer as a png and composite within php. I would recommend making sure each png has the same dimension. Don't try to position a tiny png over a larger one. Give them the same dimensions to make alignment a breeze.

这篇关于基于php的Photoeffects网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆