wic

How to create a lossless jpg using WIC in Delphi

我与影子孤独终老i 提交于 2019-12-02 01:32:33
I have the following code working to create a jpg file out of a IWICBitmapSource with defaults options: function SaveWICBitmapToJpgFile(WICFactory: IWICImagingFactory; WICBitmap: IWICBitmapSource; SrcRect: TRect; FileName: string): HRESULT; var hr: HRESULT; Encoder: IWICBitmapEncoder; Frame: IWICBitmapFrameEncode; PropBag: IPropertyBag2; S: IWICStream; PixelFormatGUID: WICPixelFormatGUID; R: WICRect; begin hr := WICFactory.CreateStream(S); if Succeeded(hr) then begin hr := S.InitializeFromFilename(PChar(FileName), GENERIC_WRITE); end; if Succeeded(hr) then begin hr := WICFactory.CreateEncoder

WIC CreateDecoderFromStream returning 0x88982F50 post server migration

僤鯓⒐⒋嵵緔 提交于 2019-11-30 23:39:31
I have a thumbnail generation routine that I created using WIC for a .NET app. It has been working fine for the past year, but we just migrated to a new server. Old Server was W2k8 R2 Enterprise SP1 New Server is W2k8 Standard SP1 Here's the code that is failing Public Sub New(ByVal PictureData As Byte()) Me.WICFactory = New WICImagingFactory() Dim InputStream As IWICStream = WICFactory.CreateStream() InputStream.InitializeFromMemory(PictureData, PictureData.Length) InputDecoder = WICFactory.CreateDecoderFromStream(InputStream, Nothing, WICDecodeOptions.WICDecodeMetadataCacheOnDemand) '^=====

WIC CreateDecoderFromStream returning 0x88982F50 post server migration

£可爱£侵袭症+ 提交于 2019-11-30 18:09:14
问题 I have a thumbnail generation routine that I created using WIC for a .NET app. It has been working fine for the past year, but we just migrated to a new server. Old Server was W2k8 R2 Enterprise SP1 New Server is W2k8 Standard SP1 Here's the code that is failing Public Sub New(ByVal PictureData As Byte()) Me.WICFactory = New WICImagingFactory() Dim InputStream As IWICStream = WICFactory.CreateStream() InputStream.InitializeFromMemory(PictureData, PictureData.Length) InputDecoder = WICFactory

Replace GDI+ DrawImage with PInvoked GDI and transparent PNG's

血红的双手。 提交于 2019-11-30 07:31:29
I've created an image service in C# which takes a base layer image (JPG), layers one more more transparent PNG's (32 bit), and then outputs a final JPG image. I'm trying to squeeze every last millisecond out of this function and my code is bottlenecking at the DrawImage call in GDI+. Managed code here: // Load base image and create graphics Image image = LoadImage(renderSettings.RenderedImageDirectory + baseLayer); Graphics graphics = Graphics.FromImage(image); graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graphics.InterpolationMode = System.Drawing

Replace GDI+ DrawImage with PInvoked GDI and transparent PNG's

两盒软妹~` 提交于 2019-11-29 10:30:00
问题 I've created an image service in C# which takes a base layer image (JPG), layers one more more transparent PNG's (32 bit), and then outputs a final JPG image. I'm trying to squeeze every last millisecond out of this function and my code is bottlenecking at the DrawImage call in GDI+. Managed code here: // Load base image and create graphics Image image = LoadImage(renderSettings.RenderedImageDirectory + baseLayer); Graphics graphics = Graphics.FromImage(image); graphics.CompositingQuality =

Windows StretchBlt API performance

拜拜、爱过 提交于 2019-11-29 08:05:05
I timed a DDB drawing operation which uses multiple StretchBlt and StretchDIBits calls. And I found that, time to complete is increase/decrease proportionally to the destination window size. With 900x600 window it takes around 5ms, but with 1920x1080 it takes as large as 55ms (source image is 1280x640). It seems Stretch.. APIs don't use any hardware acceleration features. Source image (actually this is temporary drawing canvas) is created with CreateDIBSection because I need resulting (stretched and merged) bitmap's pixel data for every frame drawn . Let's assume, Windows GDI is hopeless. Then

How to save ID2D1Bitmap to PNG file

懵懂的女人 提交于 2019-11-28 02:04:22
I faced a problem when trying to save ID2D1Bitmap (that created from ID2D1HwndRenderTarget) to PNG File. The output image is just empty with white color. HRESULT returned from function call EndDraw() is -2003238894. Thanks for any help. Here is my code: HRESULT CImageUtil::SaveBitmapToFile(PCWSTR uri,ID2D1Bitmap* pBitmap,ID2D1RenderTarget* pRenderTarget) { HRESULT hr = S_OK; ID2D1Factory *pD2DFactory = NULL; IWICBitmap *pWICBitmap = NULL; ID2D1RenderTarget *pRT = NULL; IWICBitmapEncoder *pEncoder = NULL; IWICBitmapFrameEncode *pFrameEncode = NULL; IWICStream *pStream = NULL; if (SUCCEEDED(hr))

Windows StretchBlt API performance

五迷三道 提交于 2019-11-28 01:46:51
问题 I timed a DDB drawing operation which uses multiple StretchBlt and StretchDIBits calls. And I found that, time to complete is increase/decrease proportionally to the destination window size. With 900x600 window it takes around 5ms, but with 1920x1080 it takes as large as 55ms (source image is 1280x640). It seems Stretch.. APIs don't use any hardware acceleration features. Source image (actually this is temporary drawing canvas) is created with CreateDIBSection because I need resulting

How to save ID2D1Bitmap to PNG file

巧了我就是萌 提交于 2019-11-26 22:05:07
问题 I faced a problem when trying to save ID2D1Bitmap (that created from ID2D1HwndRenderTarget) to PNG File. The output image is just empty with white color. HRESULT returned from function call EndDraw() is -2003238894. Thanks for any help. Here is my code: HRESULT CImageUtil::SaveBitmapToFile(PCWSTR uri,ID2D1Bitmap* pBitmap,ID2D1RenderTarget* pRenderTarget) { HRESULT hr = S_OK; ID2D1Factory *pD2DFactory = NULL; IWICBitmap *pWICBitmap = NULL; ID2D1RenderTarget *pRT = NULL; IWICBitmapEncoder