我从这里找到了一篇关于图像处理的文章:http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing一切正常.
我希望在调整图像大小时保持高质量.我想如果我能提高DPI值,我就可以做到这一点.有谁知道这是否可能?如果是这样,我如何在C#中实现它?
我有一个Android应用程序,由API支持.对于此API用户可以上传照片.然后需要根据几个类别将这些照片缩放到几个不同的密度.
有没有推荐尺寸的任何地方或之前解决过这个问题的人?
我想我需要填写这个网格,知道调整图像大小(缩小)的大小(假设用户上传了一个4000x4000px图像,或其他什么):
Role / Screen | LDPI | MDPI | HDPI | XHDPI |
--------------------------------------------
Icon | ? | ? | ? | ? |
--------------------------------------------
Thumbnail | ? | ? | ? | ? |
--------------------------------------------
Full | ? | ? | ? | ? |
Run Code Online (Sandbox Code Playgroud)
然后,API将返回JSON响应,如下所示:
{
resources: {
icon: {
ldpi: "path",
mdpi: "path",
hdpi: "path",
xhdpi: "path",
raw: "path"
},
thumbnail: { ... },
full: { ... }
}
}
Run Code Online (Sandbox Code Playgroud)
然后,客户端设备可以检查密度本身是什么,并使用适当的密钥路径来渲染图像.
我知道根据这个,"你应该遵循3:4:6:8缩放比率",但你怎么知道的图像应该用什么尺寸,缩放别人呢?
编辑: …
我正在尝试调整使用powerpoint vba从Excel粘贴到powerpoint中的图片的大小。
我的代码说:
ActivePresentation.Slides(9).Select
Application.ActiveWindow.View.PasteSpecial DataType:=ppPasteEnhancedMetafile
这部分工作正常,我不知如何在下一步中调整图片的大小。我是使用Powerpoint VBA的新手。
任何帮助将非常感激。
div#ipsko更改宽度和高度以满足绝对定位。为什么img#utas没有?
JSFiddle:http : //jsfiddle.net/pejh7/1/
HTML代码:
<div id="upsko">
<img id="utas" src="http://kharg.czystybeton.pl/108.png" />
<div id="ipsko"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS代码:
div#upsko {
position: relative;
top: 200px; left: 200px; width: 100px; height: 100px;
background: rgba(255,0,0,0.5);
}
img#utas {
position: absolute;
top: 10px; left: 10px; right: 10px; bottom: 10px;
}
div#ipsko {
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background: rgba(0,255,0,0.5);
}
Run Code Online (Sandbox Code Playgroud) UIImage的resizableImageWithCapInsets方法对于带有圆角的标准矩形按钮来说都很好,但我正在尝试创建一个看起来像云的边缘不均匀的按钮.我不能完全理解绘制或创建它的最佳方式,或者当我将它放入应用程序时我将如何拉伸它.我在谈论这样的事情:

云端两侧的气泡不应该伸展,但会创建新的气泡,无论多长/短按钮都需要.例如,如果按钮需要是此图像大小的一半,则只显示2个气泡,但如果它需要更高,超过这里的5个,它会根据需要添加和删除它们. .我设定了最小尺寸,以便至少有一个气泡可以存在,防止问题,如果它太小.如果需要,泡沫本身可以平铺.
从软件开发或平面设计的角度来看,有没有人对如何实现这样的效果有任何建议?
编辑:
我已经尝试使用下面的图像和下面的代码执行此操作,并且它会像这里的图像一样给出结果.图像甚至不是合适的尺寸,更不用说平铺了.我已经确认图像的帧大于此处显示的帧.真的很困惑!
cappedCloud = [[UIImage imageNamed: @"cloud.png"] resizableImageWithCapInsets: UIEdgeInsetsMake(9, 9, 9, 9) resizingMode: UIImageResizingModeTile];
[[cell.cloudButton imageView] setContentMode: UIViewContentModeScaleToFill];
[cell.cloudButton setImage: cappedCloud forState: UIControlStateNormal];
[cell.cloudButton setAlpha: 0.85f];
Run Code Online (Sandbox Code Playgroud)


如何根据固定(310.0f)UIImageView宽度获得UIImageView的高度以获得逼真的图像?
所以这个东西应该适用于将UIImageViews放在UITableViewCells中(这对于问题并不重要).但我想指出一些例子:9gag应用程序,脸书,谷歌+和其他图片调整大小并放入UITableViewCell
我基本上想做的是将一个图像调整为两个不同大小的图像。但是我只能先调整大小,featured_$filename而不能调整大小thumb_$filename。
最初,我尝试创建单个函数,并将配置作为数组传递,但没有成功,但同一件事,仅调整了单个图像的大小。
$this->resizeImage($imagePath, $file['upload_data']['file_name']);
$this->resizeThumb($imagePath, $file['upload_data']['filename']);
public function resizeImage($imagePath, $filename){
$config['image_library'] = 'gd2';
$config['source_image'] = $imagePath;
$config['create_thumb'] = FALSE;
$config['new_image'] = 'featured_'.$filename;
$config['maintain_ratio'] = TRUE;
$config['width'] = 570;
$config['height'] = 372;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
}
public function resizeThumb($imagePath, $filename){
$config['image_library'] = 'gd2';
$config['source_image'] = $imagePath;
$config['create_thumb'] = FALSE;
$config['new_image'] = 'thumb_'.$filename;
$config['maintain_ratio'] = TRUE;
$config['width'] = 180;
$config['height'] = 135;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将多个图像上传到服务器并为每个图像制作不同的分辨率版本.要做到这一点,我第一次使用class.upload.php.http://www.verot.net/php_class_upload.htm
我查看文档并从演示示例开始http://www.verot.net/php_class_upload_download_zip.htm
我做了一个多输入的表格
<form name="form3" enctype="multipart/form-data" method="post" action="upload.php">
<p><input type="file" size="32" name="my_field[]" value="" /></p>
<p><input type="file" size="32" name="my_field[]" value="" /></p>
<p><input type="file" size="32" name="my_field[]" value="" /></p>
<p><input type="file" size="32" name="my_field[]" value="" /></p>
<p><input type="file" size="32" name="my_field[]" value="" /></p>
<p class="button"><input type="hidden" name="action" value="multiple" />
<input type="submit" name="Submit" value="upload" /></p>
</form>
Run Code Online (Sandbox Code Playgroud)
示例中的原始php仅上传图像而不调整大小:
$files = array();
foreach ($_FILES['my_field'] as $k => $l) {
foreach ($l as $i => $v) {
if (!array_key_exists($i, $files))
$files[$i] = array();
$files[$i][$k] = $v;
} …Run Code Online (Sandbox Code Playgroud) 在java中你怎么能让游戏完全实现!但是逻辑和图形可以用它吗?我尝试过使用SCALE方法.但这并不能让每台电脑完全全屏.所以我做了这个:
public void resize(int WIDTH, int HEIGHT, boolean UNDECORATED) {
frame.setPreferredSize(new Dimension(WIDTH, HEIGHT));
frame.setMaximumSize(new Dimension(WIDTH, HEIGHT));
frame.setMinimumSize(new Dimension(WIDTH, HEIGHT));
this.WIDTH = WIDTH;
this.HEIGHT = HEIGHT;
frame.setUndecorated(UNDECORATED);
frame.setSize(WIDTH, HEIGHT);
}
Run Code Online (Sandbox Code Playgroud)
因此,您可以将屏幕大小设置为您想要的任何值!它工作但图形不适用它?Graphics2D中是否有一种方法可以拉伸所有图形以使其适合?例如,如果有一个方法存在,如:
G2D.resize(WIDTH, HEIGHT, Image.NEAREST_PARENT_RESCALE);
Run Code Online (Sandbox Code Playgroud)
任何的想法?
我尝试过的事情:
我不介意的事情
那么如何使用Graphics2D,JFrame制作完全可重复密封的游戏.
所以我正在开发一个图库,图片显示在一个200x200px的列表项中
#gallery-list-ui li {
display: block;
margin: 10px;
height: 200px;
width: 200px;
overflow: hidden;
}
Run Code Online (Sandbox Code Playgroud)
为了使用纵向/横向图像使用整个高度/宽度,我使用javascript来决定是否应将高度或宽度设置为100%.
var portrait = ($img.height() > $img.width() ? true : false);
if(portrait){
$img.css({'width' :'100%', 'height' : 'auto'});
} else {
$img.css({'height' :'100%', 'width' : 'auto'});
}
Run Code Online (Sandbox Code Playgroud)
结果是肖像图像正确缩放
<img src="img.jpg" style="width: 100%; height: auto;">
Run Code Online (Sandbox Code Playgroud)
但是风景图像缩放其原始高度的100%,并且不限于列表框的高度.
<img src="img.jpg" style="height: 100%; width: auto;">
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?任何人都可以解释为什么会这样吗?请看我的小提琴:https://jsfiddle.net/smyhbckx/5/
image-resizing ×10
css ×2
image ×2
objective-c ×2
php ×2
.net ×1
android ×1
c# ×1
codeigniter ×1
css-position ×1
dpi ×1
height ×1
java ×1
javascript ×1
jframe ×1
powerpoint ×1
render ×1
resize ×1
scale ×1
swing ×1
uiimage ×1
uiimageview ×1
upload ×1