如何调整图像大小并使其像原始图像一样平滑

发布于 2024-10-01 09:02:31 字数 514 浏览 0 评论 0原文

当我从数据库中回显图像并调整其大小时,我有一个宽度为 213、高度为 200 的图像 (echo "";) 图像不像 213 * 200 时那么清晰。在将其大小调整为 70 * 68 后,或者当我增加到以上时,如何才能使图像像原始图像一样平滑213 * 200。

<?php
    $query = "SELECT * FROM photo";
    $result = mysql_query ($query) or die('query error');
    $count = 0;
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
    $image = $line[picname];
    echo "<img src='company/$image'/> ";
    $count++;
    }
   ?>

i have an image which width is 213 and height is 200 when i echo the image from my database and i resize it (echo "<img src='company/$present' width='70' height='68'/>";) the image was not as clear as when it was 213 * 200. how can i make the image smooth like the original after i have resize it to 70 * 68 or rather when i increase above 213 * 200.

<?php
    $query = "SELECT * FROM photo";
    $result = mysql_query ($query) or die('query error');
    $count = 0;
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
    $image = $line[picname];
    echo "<img src='company/$image'/> ";
    $count++;
    }
   ?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

南冥有猫 2024-10-08 09:02:31

在将其大小调整为 70 * 68 或更确切地说当我增加到 213 * 200 以上时,如何使图像像原始图像一样平滑。

。特别是 Internet Explorer 似乎使用一种令人讨厌的算法来缩小图像大小。您最好使用 ImageMagick 或 PHP 的 GD 等工具包在服务器端调整图像大小。

没有什么能让升级看起来很好。

how can i make the image smooth like the original after i have resize it to 70 * 68 or rather when i increase above 213 * 200.

Internet Explorer in particular seems to use a nasty algorithm for sizing images down. You'd be best off using a toolkit like ImageMagick or PHP's GD to size the image on the server-side.

Nothing's going to make upscaling look good.

夢归不見 2024-10-08 09:02:31

添加 CSS 标签 img { -ms-interpolation-mode: bicubic; } 在 Internet Explorer 7 中选择更平滑的调整大小。IE8 已默认使用此功能。我不记得它在 IE6 中是否有效。

Add the CSS tag img { -ms-interpolation-mode: bicubic; } to choose smoother resizing in Internet Explorer 7. IE8 already uses this by default. I don't remember if it works in IE6.

梦忆晨望 2024-10-08 09:02:31

作为一般规则,不要同时明确设置图像的宽度和高度。以这种方式保持图像的纵横比变得非常困难。

As a general rule don't set both the width and the height explicitly for the image. It becomes very difficult to maintain the aspect ratio of the image that way.

夜还是长夜 2024-10-08 09:02:31

最好的方法是保持图像的长宽比,所以基本上如果图像是 800 x 1200 ,而不是将其大小调整为一定的像素大小,而是按百分比进行调整,并确保宽度和高度以相同的百分比更改。

The best way is to keep the images aspect ration, so basically if the image was 800 x 1200 , instead of resizing it to a certain pixel size do it by percent and make sure the width and height are being changed by the same percent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文