Remote Image Quality Issue and Config Inquiry
What Happened
When uploading images to Slack using the files.remote.update API, the image quality noticeably deteriorates. This reduction in quality is not observed when using other Slack file upload APIs like files.upload.
Is there any configuration or setting we can modify to preserve image quality during remote uploads?
Expected Behavior
Uploaded images should maintain their original quality, including resolution and sharpness.
Steps to Reproduce
- Use the
files.uploadAPI from Slack's messaging documentation (API link) to upload an image and observe the quality. - Use
files.remote.updateAPI to update an image with the parameters provided below. - Compare the image quality.
Reproducible Code
uploads := slack.UploadFileV2Parameters{
Filetype: "auto",
Filename: "Loading...",
FileSize: int(fileSize),
Reader: fileBuffer,
Channels: []string{n.BotEvent.ChannelID},
Channel: n.BotEvent.ChannelID,
ThreadTimestamp: n.BotEvent.ThreadTimeStamp,
Title: appMentionTmpl.Title,
//InitialComment: appMentionTmpl.InitialComment,
}
uploadResp, er := n.Messenger.CompleteUploadExternal(ctx, uploads)
payload := slack.RemoteFileParameters{
ExternalID: s.uuidGenerator.New(),
Title: fmt.Sprintf("Model: %s", n.Data[ThreadWorksheetName]),
// PreviewImage: text,
PreviewImageReader: nlsObject.Reader,
}
_, err = n.Messenger.UpdateRemoteFile(ctx, fileID, payload)
if err != nil {
return fmt.Errorf("failed to update remote file: %w", err)
}
Versions
- Go: v1.22.6
- slack-go/slack:v0.14.0
That's a bit of a misnomer. The files.remote.update doesn't upload your image to slack. You can provide a preview image to be sent but that's about it.
In effect, you're not uploading the image to Slack. You're just telling Slack where it can find your image.
Could you provide an example of an image url, and associated preview file you're trying to use in files.remote.update so that I can troubleshoot this further, just in case it has something to do with how we're handling the PreviewImageReader?