wic

WIC WINCODEC_ERR_BADHEADER only for JPEG images

若如初见. 提交于 2020-01-16 19:28:26
问题 I have a simple encoding/ decoding application using Windows Imaging Component API. The issue I'm having is that when I use either the JPEGXR or BMP formats, everything works fine. However, when I use the JPEG codec - the encoder works fine and I can visually verify the generated JPEG image, but when I try to decode that stream, I get a WINCODEC_ERR_BADHEADER (0x88982f61) Here's the line that fails: hr = m_pFactory->CreateDecoderFromStream( pInputStream, NULL, WICDecodeMetadataCacheOnDemand,

WICBitmapSource.CopyPixels to GDI Bitmap Scan0

一世执手 提交于 2019-12-25 04:04:08
问题 I've modified the C# IWICBitmapSource.CopyPixels interface to allow both array marshaling and passing a pointer: void CopyPixels( WICRect prc, uint cbStride, uint cbBufferSize, [Out] [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] pbBuffer ); new void CopyPixels( WICRect prc, uint cbStride, uint cbBufferSize, IntPtr pbBuffer ); I'm calling it like this public static Bitmap FromWic(IWICBitmapSource source) { Guid format; source.GetPixelFormat(out format); PixelFormat gdiFormat =

SaveDDSTextureToFile() saves a black texture instead the expected

无人久伴 提交于 2019-12-24 11:55:18
问题 I have created a red colored texture of DXGI format DXGI_FORMAT_R32_FLOAT. I have a byte buffer of red color pixels where 4 byte per pixel is prepared. The byte buffer is then copied using device context map and unmap functions and after that I have created a shader resource view. I have get the resource back from resource view then passed that to SaveDDSTextureToFile() to save the bitmap data to dds file format. But when I am going to save it in dds in file to check it's saves a same sized

Displaying large image with SharpDX

ぐ巨炮叔叔 提交于 2019-12-24 06:42:37
问题 I'm trying to use SharpDX to draw a large image (21000x7000) from file. The code looks like this: if (newBitmap==null) { ImagingFactory imagingFactory = new ImagingFactory(); NativeFileStream fileStream = new NativeFileStream(@"D:\path\myfile.png", NativeFileMode.Open, NativeFileAccess.Read); BitmapDecoder bitmapDecoder = new BitmapDecoder(imagingFactory, fileStream, DecodeOptions.CacheOnDemand); BitmapFrameDecode frame = bitmapDecoder.GetFrame(0); FormatConverter converter = new

What is the most effective pixel format for WIC bitmap processing?

只愿长相守 提交于 2019-12-24 05:24:06
问题 I'm trying to make a simple video player like program with Direct2D and WIC Bitmap. It requires fast and CPU economic drawing (with stretch) of YUV pixel format frame data. I've already tested with GDI. I hope switching to Direct2D give at least 10x performance gain (smaller CPU overhead). What I'll doing is basically such as below: Create an empty WIC bitmap A (for drawing canvas) Create another WIC bitmap B with YUV frame data (format conversion) Draw bitmap B onto A, then draw A to the D2D

Version of Windows Imaging Component

自闭症网瘾萝莉.ら 提交于 2019-12-24 02:53:26
问题 How can I check what version of Windows Imaging Component is installed on a Windows machine? I suspect the Windows 2008 Servers used in Azure do not have the same version that I have on my Windows 7 development machine. I just want to verify that as I need the latest TIFF codec. 回答1: Will not make a definite statement, but I think that the WIC on the Windows Azure is the same what you have on your Windows 7. Just be aware that there are 2 OS families in Windows Azure. OS Family 1.x is using

Version of Windows Imaging Component

倖福魔咒の 提交于 2019-12-24 02:53:01
问题 How can I check what version of Windows Imaging Component is installed on a Windows machine? I suspect the Windows 2008 Servers used in Azure do not have the same version that I have on my Windows 7 development machine. I just want to verify that as I need the latest TIFF codec. 回答1: Will not make a definite statement, but I think that the WIC on the Windows Azure is the same what you have on your Windows 7. Just be aware that there are 2 OS families in Windows Azure. OS Family 1.x is using

How to save a ID2D1Bitmap to a file using WIC?

心不动则不痛 提交于 2019-12-20 04:24:24
问题 I have a problem with saving a bitmap into a file. I'm using How to save ID2D1Bitmap to PNG file as a reference, but I have a different error than the one posted in that. I get error 0x88990015 HRESULT, which means: The resource used was created by a render target in a different resource domain. Here's my code: void Wnd::SavePng(LPCWSTR Path,ID2D1Bitmap* pBit) { CComPtr<ID2D1RenderTarget> pRT; CComPtr<IWICBitmap> pB; CComPtr<IWICBitmapEncoder> pEncoder; CComPtr<IWICBitmapFrameEncode> pFrame;

How to create a lossless jpg using WIC in Delphi

拜拜、爱过 提交于 2019-12-20 02:54:43
问题 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

How to save the content of a ID2D1RenderTarget to a file

落花浮王杯 提交于 2019-12-13 04:18:14
问题 I have an existing component that draws Direct2D content to an ID2D1RenderTarget and I would like to save that drawing to an image file. The questions here, here and here, although they helped me, did not provide a clear answer as how to do it. My nullth idea was to try the official MSDN method. Unfortunately, it is not available in Win7. My first idea was to modify the drawing routine to make it accept the RenderTarget as a parameter and use ID2D1Factory::CreateWicBitmapRenderTarget to draw