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

im7: Return bytes for GetImageProfile #320

Merged
merged 1 commit into from
May 31, 2024

Conversation

coderkun
Copy link

The C.MagickGetImageProfile() function returns a char array but it is not only the name of the profile but the bytes of the actual ICC profile. Therefore, change the GetImageProfile() function to return []byte instead of string the same way RemoveImageProfile() does it.

@@ -132,14 +132,14 @@ func (mw *MagickWand) GetImageArtifacts(pattern string) (artifacts []string) {
// GetImageProfile Returns the named image profile.
//
// name: Name of profile to return: ICC, IPTC, or generic profile.
func (mw *MagickWand) GetImageProfile(name string) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't break the existing API. What if we rename this function to GetImageProfileBytes, and then make a GetImageProfile call GetImageProfileBytes and return a string?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback. I added a new function GetImageProfileBytes() and changed GetImageProfile() back to return a string.

The C.MagickGetImageProfile() function returns a char array but it is
not only the name of the profile but the bytes of the actual ICC
profile. Add the function GetImageProfileBytes() to return []byte the
same way RemoveImageProfile() does it. Keep the existing function
GetImageProfile() to return a string to not break the existing API but
adjust it to call GetImageProfileBytes() internally.
@justinfx justinfx merged commit 76b9205 into gographics:im-7 May 31, 2024
1 of 2 checks passed
@justinfx
Copy link
Member

Thanks for those fixes!

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

Successfully merging this pull request may close these issues.

2 participants