alexandercerutti / passkit-generator

The easiest way to generate custom Apple Wallet passes in Node.js
MIT License
897 stars 109 forks source link

[Generic-Pass]: Need to set the background image properties #195

Closed prashant03Dev closed 7 months ago

prashant03Dev commented 7 months ago

Running OS

Windows,Mac

Running Node Version

Version : v18.20.0

Description

-As we have created a generic pass and loaded all the images as per the size provided in the package.But currently We need to change some background properties.

Expected behavior

Background properties should be change as per the user request

Source Code:

const passCreated: PassKit.PKPass = await this.walletService.createPass( 'Generic.pass', this.user.uuid, 'membership-card-pass', );

    try {
        passCreated.type = this.pass.type;

        passCreated.props.beacons
        passCreated.primaryFields.push({
            key: 'memberName',
            label: 'Member Name',
            value: `${this.user.insuredName}`,
            textAlignment: 'PKTextAlignmentRight',
        });

        passCreated.secondaryFields.push({
            key: 'memberNumber',
            label: 'Member Number',
            value: `${this.user.memberId}`,
            textAlignment: 'PKTextAlignmentRight',
        });

@alexandercerutti Suggest us the way to set the background properties dynamically or in pass.json file.

alexandercerutti commented 7 months ago

Hi @prashant03Dev, thanks for using passkit-generator!

In the API documentation (which I can suppose you didn't read or didn't see), there is a beautiful 🌟 method called addBuffer(), that I think might suit you needs to change the background image! πŸ˜‰

Let me know.

prashant03Dev commented 7 months ago

Hi Alex,

Thanks for mentioning method for better clarification,But as I can see there are not any methods to set the background related changes,

As of now the generic pass image that i stored,is getting blurriness,So to remove that I'm getting troubling,

Can you suggest me the method or a way to do that!

Thanks

On Fri, Apr 5, 2024 at 1:49β€―PM Alexander Cerutti @.***> wrote:

Hi @prashant03Dev https://github.com/prashant03Dev, thanks for using passkit-generator!

In the API documentation (which I can suppose you didn't read or didn't see), there is a beautiful 🌟 method called addBuffer(), that I think might suit you needs πŸ˜‰

Let me know.

β€” Reply to this email directly, view it on GitHub https://github.com/alexandercerutti/passkit-generator/issues/195#issuecomment-2039226478, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOEUDQMGXFUM5J7LNUCJTY3ZNADAVCNFSM6AAAAABFYT2NMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGIZDMNBXHA . You are receiving this because you were mentioned.Message ID: @.***>

alexandercerutti commented 7 months ago

Sorry but I don't have clear your exact use case.

You can set a backgroundImage file but you cannot remove the blur effect. That's an Apple feature for passes that support the background image (not all of them does). This is what Documentation Archive says about:

The background image (background.png) is displayed behind the entire front of the pass. The expected dimensions are 180 x 220 points. The image is cropped slightly on all sides and blurred. Depending on the image, you can often provide an image at a smaller size and let it be scaled up, because the blur effect hides details. This lets you reduce the file size without a noticeable difference in the pass.

Is "removing the blur" the only thing you were trying to achieve?

prashant03Dev commented 7 months ago

Hi Alex,

Is there any pass which has the background without blur effect?

On Fri, Apr 5, 2024 at 3:38β€―PM Alexander Cerutti @.***> wrote:

Sorry but I don't have clear your exact use case.

You can set a backgroundImage file but you cannot remove the blur effect. That's an Apple feature for passes that support the background image (not all of them does). This is what Documentation Archive says https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW1 about:

The background image (background.png) is displayed behind the entire front of the pass. The expected dimensions are 180 x 220 points. The image is cropped slightly on all sides and blurred. Depending on the image, you can often provide an image at a smaller size and let it be scaled up, because the blur effect hides details. This lets you reduce the file size without a noticeable difference in the pass.

Is "removing the blur" the only thing you were trying to achieve?

β€” Reply to this email directly, view it on GitHub https://github.com/alexandercerutti/passkit-generator/issues/195#issuecomment-2039407833, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOEUCCYEOIH2N3VLWNBSTY3ZZZPAVCNFSM6AAAAABFYT2NMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGQYDOOBTGM . You are receiving this because you were mentioned.Message ID: @.***>

alexandercerutti commented 7 months ago

I don't think so. I think the idea of Apple is that a blurred image helps to improve readability and reduce the details a user can focus on (hence, the "noise" a background image can bring)

prashant03Dev commented 7 months ago

Thanks Alex for helping within a short span of time!

On Fri, Apr 5, 2024 at 3:42β€―PM Alexander Cerutti @.***> wrote:

I don't think so. I think the idea of Apple is that a blurred image helps to improve readability.

β€” Reply to this email directly, view it on GitHub https://github.com/alexandercerutti/passkit-generator/issues/195#issuecomment-2039415423, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOEUFBO5CE6C2P6546SRTY3Z2HDAVCNFSM6AAAAABFYT2NMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGQYTKNBSGM . You are receiving this because you were mentioned.Message ID: @.***>

alexandercerutti commented 7 months ago

So, can we close the issue? :)

prashant03Dev commented 7 months ago

Yes, please!

On Fri, Apr 5, 2024 at 3:45β€―PM Alexander Cerutti @.***> wrote:

So, can we close the issue? :)

β€” Reply to this email directly, view it on GitHub https://github.com/alexandercerutti/passkit-generator/issues/195#issuecomment-2039422196, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOEUCJ4Z3U7HKZKBYE733Y3Z2VVAVCNFSM6AAAAABFYT2NMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGQZDEMJZGY . You are receiving this because you were mentioned.Message ID: @.***>

alexandercerutti commented 7 months ago

Glad I could help you! If you could leave a 🌟 on the project, that would be awesome! πŸš€

prashant03Dev commented 7 months ago

Glad I could help you! If you could leave a 🌟 on the project, that would be awesome! πŸš€

🌟

alexandercerutti commented 7 months ago

I mean, that's not the star I was expecting, but fine... πŸ˜…πŸ€£

prashant03Dev commented 7 months ago

Fixed!

On Fri, 5 Apr 2024 at 3:56β€―PM, Alexander Cerutti @.***> wrote:

I mean, not the star I was expecting, but fine... πŸ˜…

β€” Reply to this email directly, view it on GitHub https://github.com/alexandercerutti/passkit-generator/issues/195#issuecomment-2039440426, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5JOEUD5ZV4UZR7GOAAR3MDY3Z355AVCNFSM6AAAAABFYT2NMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGQ2DANBSGY . You are receiving this because you modified the open/close state.Message ID: @.***>