Home › Forums › TWAIN Classic › The problem of RGB and BGR,can you help me?
- This topic has 4 replies, 3 voices, and was last updated 10 years, 10 months ago by spike.
- AuthorPosts
Data transmission of Twain DS to APP, some APP after receiving the RBG generated image, some are used to generate BGR image, figure image in XnView is normal, blue (RGB), and in the Photoshop look is not normal, partial red (BGR), for solving this is the problem of DS or APP question, this problem is really exist or not?
twain DS的数据传输给APP后,有的APP接收后用RBG生成图像,有的却用BGR生成图像,弄的图像在xnview看的是正常的,偏蓝(即RGB),而在photoshop里看的是不正常的,偏红(即BGR),求解这是DS的问题还是APP的问题呢,这个问题是确实存在还是根本不是问题?Are you using different TWAIN transfer modes in these applications?
Are you the programmer od the DS? If so, take care how you create the stripes in buffered memory mode.
Best regards,
Kaij
http://www.jse.deAs Kaij suggests, color data in TWAIN can be formatted in different ways.
On Windows only:In Native transfer mode, the DS sends the image in DIB format, so pixels are BGR in memory (and rows are aligned on DWORD boundaries, etc.) If you transfer indexed-color data – TWPT_PALETTE – the color values are in the color table of the DIB, so they are stored as RGBQUAD’s. Read all about it here:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx
(I have never seen a DS send 16-bit or 32-bit data in Native format, or use any compression except BI_RGB == 0)In Memory transfer mode, I believe color data is RGB, assuming it is uncompressed.
In File transfer mode, the format follows the standard format for the type of file.
Thank you, solve the problem, the original XnView and twain example APP in local mode transmission, and Photoshop is the memory mode transmission, local transmission of DIB is required, will I data into BGR, but memory transmission mode is directly transmitted without data format.
谢谢您们,问题解决了,原来xnview和twain的例子APP是用本地方式传输,而photoshop是用内存方式传输,本地方式传输是传DIB,需将我的数据变为BGR,而内存传输方式是直接传无格式数据。Exactly. 8)
- AuthorPosts