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

Image unknown format #179

Closed
jobnte opened this issue Jan 15, 2018 · 3 comments
Closed

Image unknown format #179

jobnte opened this issue Jan 15, 2018 · 3 comments
Labels
needs more info This issue can't reproduce, need more info

Comments

@jobnte
Copy link

jobnte commented Jan 15, 2018

I'm just trying to add an image file but when I generate the excel an error shows up. (I'm just following the examples)

. There is a one.jpg file in the same directory that the .exe generated by golang.
. I used the command go build

image

xlsx := excelize.NewFile()
	sheet := "Sheet1"

	xlsx.SetCellValue(sheet, "A2", "Picture")

	errx := xlsx.AddPicture(sheet, "A3", "https://i.imgur.com/sJUvygL.png", "")
	if errx != nil {
		fmt.Println(errx)
	}
	err := xlsx.SaveAs("./testing.xlsx")
```
` 
@xuri
Copy link
Member

xuri commented Jan 16, 2018

Thanks for your issue, I have checked metadata of the image by exif.regex.info/exif.cgi, although the file extension is .png, but the encoding type actually is jpeg, so you need to import _ "image/jpeg".

@jobnte
Copy link
Author

jobnte commented Jan 16, 2018

I have been imported

_ "image/gif"
_ "image/jpeg"
_ "image/png"

@xuri
Copy link
Member

xuri commented Jan 20, 2018

Please provides Excelize version or commit ID, Golang version you are using. I suggest that fill in the complete necessary information in the issue template when you create a new issue, that's will be saving our time.

@xuri xuri added the needs more info This issue can't reproduce, need more info label Dec 18, 2018
@xuri xuri closed this as completed Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info This issue can't reproduce, need more info
Projects
None yet
Development

No branches or pull requests

2 participants