TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

The problem of RGB and BGR,can you help me?

Forums › TWAIN Classic › The problem of RGB and BGR,can you help me?

  • This topic has 4 replies, 3 voices, and was last updated 7 years, 8 months ago by spike.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 6, 2013 at 2:46 am #22843 Reply
    pamxy520
    Participant
    • Topics - 7
    • Replies - 11
    • Total Posts - 18

    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的问题呢,这个问题是确实存在还是根本不是问题?

    May 6, 2013 at 9:59 am #25877 Reply
    Kaij
    Participant
    • Topics - 9
    • Replies - 132
    • Total Posts - 141

    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.de

    May 7, 2013 at 7:44 pm #25878 Reply
    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    As 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.

    May 14, 2013 at 1:43 pm #25879 Reply
    pamxy520
    Participant
    • Topics - 7
    • Replies - 11
    • Total Posts - 18

    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,而内存传输方式是直接传无格式数据。

    May 14, 2013 at 2:24 pm #25880 Reply
    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    Exactly. 8)

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: The problem of RGB and BGR,can you help me?
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.