怎么修改图片的垂直和水平dpi[已解决]
本帖最后由 1007236046 于 2013-10-5 22:35 编辑在GDIPlus.au3中,有_GDIPlus_ImageGetVerticalResolution和_GDIPlus_ImageGetHorizontalResolution可以获取图片的dpi,但是没有找到设置dpi的函数
#include <ScreenCapture.au3>
_GDIPlus_Startup()
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
MsgBox(0,_GDIPlus_ImageGetVerticalResolution($hImage),_GDIPlus_ImageGetHorizontalResolution($hImage))
;_GDIPlus_ImageSaveToFile($hImage,@ScriptDir & "\jietu123.jpg") ;保存截图
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown() 楼主的要求是修改图片的分辨率?是的话,可以搜索论坛。 回复 2# user3000
论坛里修改分辨率都是改图片宽高的,不过还是谢谢你提醒,找了下gdiplusex.au3发现了_GDIPlus_BitmapSetResolution,问题解决。#include <ScreenCapture.au3>
#include <gdiplusex.au3>
_GDIPlus_Startup()
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$xdpi = _GDIPlus_ImageGetHorizontalResolution($hImage)
$ydpi = _GDIPlus_ImageGetVerticalResolution($hImage)
_GDIPlus_ImageSaveToFile($hImage,@ScriptDir & "\" & $xdpi & "-" & $ydpi &".jpg") ;保存截图
_GDIPlus_BitmapSetResolution($hImage,2*$xdpi,2*$ydpi)
_GDIPlus_ImageSaveToFile($hImage,@ScriptDir & "\" & 2*$xdpi & "-" & 2*$ydpi &".jpg") ;保存修改dpi后截图
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown()
页:
[1]