Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust the rendering of PNG and SVG formats for ACS style #2175

Closed
ljubica-milovic opened this issue Jul 19, 2024 · 2 comments · Fixed by #2434
Closed

Adjust the rendering of PNG and SVG formats for ACS style #2175

ljubica-milovic opened this issue Jul 19, 2024 · 2 comments · Fixed by #2434
Assignees
Labels
ACS standard phase III SVG/PNG Bucket: Bugs related to SVG/PNG export Team G

Comments

@ljubica-milovic
Copy link
Collaborator

ljubica-milovic commented Jul 19, 2024

Background
Currently, the settings are not supported by rendering in PNG and SVG format.

Requirements

  • The following parameters should be processed for rendering:
    atomColoring - existing option render-coloring
    render-font-size
    render-font-size-unit
    render-font-size-sub
    render-font-size-sub-unit
    image-resolution (int number, default 72 ppi)
    bond-length-unit
    bond-length
    render-bond-thickness
    render-bond-thickness-unit
    render-output-sheet-width (default value: Letter format width = 11 inches)
    render-output-sheet-height (default value: Letter format height = 8.5 inches)

  • conversion from angstroms to units is done using bond-length. First calculate minimal bond length in angstrom b_ang (exclude zero bonds < eps=0.001) . Then take bond-length and bond-length-unit and calculate ang_to_in (angstorm to inch) conversion using minimal bond b_ang. Then calculate bond length in pixels using render-image-resolution
    e.g. if bond-length = 0.2 in, b_ang = 0.9A, then ang_to_in = 0.2/0.9 (in/A)= 0.22 in/A
    if render-image-resolution=600ppi, and bond is 1.5A then in pixels bond_length = 600 * 0.22 * 1.5 (px). And every object in angstroms (e.g. margin size) can be recalculated to pixels as object_size_A * ang_to_in * render-image-resolution

  • if render-output-sheet-width, render-output-wheet-height are specified then render should generate output image with specified height or width. The priority should be taken to width. E.g. if width and height both specified then take width (and calculate height according to bounding box of result structure). If width is not specified, then take height. If no properties were specified the calculate image size according to average bond length.

Additional information

Full JSON file of Settings is:
new JSON for settings.json.zip

The new settings hashSpacingUnit hashSpacing imageResolution related issue: epam/ketcher#5152
hashSpacingUnit values can be in cm/pt/px/in
hashSpacing number with 1 decimal places
the settings were moved to #2246

render-image-resolution can be high/low; PNG images should be able to be exported with the resolution of 600ppi (ACS standard preferred resolution/high resolution)> Current resolution (72ppi) is considered as low resolution.
Regardless of the resolution, the size of the image should be such that one bond is ~0,5cm (0,2in/14,4pt) long when printed/100% zoom.

The new settings bond-length-unit bond-length reactionComponentMarginSizeUnit reactionComponentMarginSize related issue: #2176

The new settings render-font-size-unit render-font-size-sub-unit render-bond-thickness-unit render-stereo-bond-width-unit related issue: epam/ketcher#5200

The setting render-bond-spacing related issue: epam/ketcher#5154

render-output-format-width render-output-format-hHeight are only for Indigo, Ketcher should not implement these parameters.

related task: #2246

@ljubica-milovic ljubica-milovic changed the title Increase the resolution and size of PNG Adjust the resolution and size of PNG Jul 23, 2024
@AnnaKosol AnnaKosol transferred this issue from epam/ketcher Aug 2, 2024
@AnnaKosol AnnaKosol added SVG/PNG Bucket: Bugs related to SVG/PNG export ACS standard labels Aug 2, 2024
@AnnaKosol AnnaKosol changed the title Adjust the resolution and size of PNG Adjust the rendering of PNG and SVG formats for ACS sty] Aug 5, 2024
@AnnaKosol AnnaKosol changed the title Adjust the rendering of PNG and SVG formats for ACS sty] Adjust the rendering of PNG and SVG formats for ACS style Aug 5, 2024
@AlexeyGirin
Copy link
Collaborator

ACS-StyleGuide.pdf

AliaksandrDziarkach added a commit that referenced this issue Sep 26, 2024
Also contains changes for #2246. Update code. Add UT.
@AlekseiKhariukov AlekseiKhariukov added this to the Indigo-1.25.0-rc.1 milestone Sep 30, 2024
AlexanderSavelyev pushed a commit that referenced this issue Sep 30, 2024
…2434)

Co-authored-by: Aliakasndr Dziarkach <Aliakasndr.Dziarkach@gmail.com>
@AnnaKosol
Copy link
Collaborator

Verified
Environment
https://rc.test.lifescience.opensource.epam.com/KetcherDemoSA/index.html
Ketcher Version 2.26.0-rc.1 Build at 2024-10-04; 18:45:04
Indigo Version 1.25.0-rc.1.0-g704673fcb-wasm32-wasm-clang-19.0.0
MacOs
Chrome 129.0.6668.71 (Official Build) (arm64)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACS standard phase III SVG/PNG Bucket: Bugs related to SVG/PNG export Team G
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants