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

Add support for PNG/JPEG images with WCS #173

Closed
tboch opened this issue Jun 25, 2024 · 1 comment
Closed

Add support for PNG/JPEG images with WCS #173

tboch opened this issue Jun 25, 2024 · 1 comment
Labels

Comments

@tboch
Copy link
Collaborator

tboch commented Jun 25, 2024

In a similar manner to support of FITS images, it would be great to be able to visualize PNG/JPEG images with astrometry information.
In the long term, we might want to support astrometry serialized as AVM tags inside the PNG/JPEG, but to start with, we could have a new method allowing one to display a PNG/JPEG, passing the astrometry as a separate WCS JS dictionary.

@tboch tboch added the feature label Jun 25, 2024
@bmatthieu3
Copy link
Collaborator

I took some time to develop this API-like thing:

let aladin = A.aladin('#aladin-lite-div', {fov: 30, survey: "CDS/P/GALEXGR6/AIS/FUV", target: "280 +0", projection: "AIT"});

aladin.setOverlayImageLayer(
  A.image(
    "https://nova.astrometry.net/image/25038473?filename=M61.jpg",
    {
        name: "M61",
        imgFormat: 'jpeg',
        wcs: {
            NAXIS: 0, // Minimal header
            CTYPE1: 'RA---TAN', // TAN (gnomic) projection + SIP distortions
            CTYPE2: 'DEC--TAN', // TAN (gnomic) projection + SIP distortions
            EQUINOX: 2000.0, // Equatorial coordinates definition (yr)
            LONPOLE: 180.0, // no comment
            LATPOLE: 0.0, // no comment
            CRVAL1: 185.445488837, // RA of reference point
            CRVAL2: 4.47896032431, // DEC of reference point
            CRPIX1: 588.995094299, // X reference pixel
            CRPIX2: 308.307905197, // Y reference pixel
            CUNIT1: 'deg', // X pixel scale units
            CUNIT2: 'deg', // Y pixel scale units
            CD1_1: -0.000223666022989, // Transformation matrix
            CD1_2: 0.000296578064584, // no comment
            CD2_1: -0.000296427555509, // no comment
            CD2_2: -0.000223774308964, // no comment
            NAXIS1: 1080, // Image width, in pixels.
            NAXIS2: 705 // Image height, in pixels.
        },
        successCallback: (ra, dec, fov, image) => {
            aladin.gotoRaDec(ra, dec);
            aladin.setFoV(fov)
        }
    },
));

and the result

image

The WCS comes from astrometry.net. I removed the SIP corrections keywords as it is currently not yet supported by wcs-rs lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants