Odoo Help


How to use base64 encoder in purpose to import images?

Viktor Aditya
on 4/9/13, 3:33 AM 6,671 views

I read some question about how to import image from csv files, and i'm trying to implement it.. but because i'm not really good at IT,i dont really know about how to use base64..

i already try to encode image using base64 and base64 give me a very long code.. then i try to copy and paste it in my csv, and when i try to import it, OpenERP refuse it..

do i need to simplified the code or anything?

Can you please share your file with 2/3 records.

on 6/1/13, 6:18 AM

Marc Cassuto

--Marc Cassuto--
Arche TI
| 4 5 8
Montreal, Canada
--Marc Cassuto--

Marc Cassuto
On 8/2/13, 5:43 PM

Here the complete procedure for Linux users :

1/ import all your products

2/ export your products : this step is mandatory to get the external ID of your product. In my case I exported Name (that is mandatory) and ean13 since the picture's filename was name as follow :


3/ open your exported file (product.product.csv) with libreoffice and save it again with option "edit filter settings" in order to change the CSV separator to whatever else than ",". This is a little trick to avoid complicated script to deal with record that embed a coma.

4/ use the following script :

    # Usage : MakeBase64CSV.sh infile.csv outfile.csv
    # infile.csv columns are : externalID, name, filename or identifier
    # infile.csv separator MUST BE |

echo \"External ID\",\"Name\",\"image\" > $2

while IFS="|" read f1 f2 f3; do

    # recopy external ID and name
    echo -n $f1,\"$f2\", >> $2

    #If third column represents the picture's filename (not the key), please use this command
    #cat $(echo ${f3} | tr -d '\r' | tr -d '"') | base64 --wrap=0 >> $2

    #If third column represents the key to match with the filename, please use this command
    cat $(echo ${f3} | tr -d '\r' | tr -d '"').jpg | base64 --wrap=0 >> $2

    #Carrier return at end of line
    echo  >> $2
done < $1

5/ then use your script

./MakeBase64CSV.sh product.product.csv out.csv

In my example, all the pictures are in the same directory.

6/ you can now import your file out.csv into openERP. (Don't forget to change the CSV separator).

7/ If you run into the following error :

field larger than field limit (131072)

Please do the following :

  • modify the file addons/base_import/models.py
  • add the following line at the very begining of the _convert_import_data function :


  • delete the file addons/base_import/models.pyc

  • restart your server
  • redo the import of your out.csv file

On Odoo v8, the path `csv.field_size_limit(140000000)` should be inserted at the beginning of the function `_read_csv`.

Jairo Llopis
on 10/21/14, 4:15 AM

Just made a first use of the above script; but the outfile obtained is appending the external_id of another line (product) at the end of the image field (after the conversion data). ex:/9j/4AAQSkZJRgABAgAAZABkA........................................................__export__.product_template_266861 What is wrong with my data?

AD LIBITOM, michel Guénard
on 5/9/15, 4:01 AM

What means ' separator MUST BE | ' ?

MEXYTUL, Diego Calzadilla
on 5/21/15, 1:31 PM

CSV = Comma-Separated Values. But you must save it separated by "|", not by "," nor ";". You cannot do that in Excel, try LibreOffice Calc.

Jairo Llopis
on 5/22/15, 3:13 AM


AD LIBITOM, Thomas Guénard
on 6/16/16, 7:57 AM
Cyrus Waithaka
On 6/16/16, 12:37 AM

I had created a free module that can enable you to import product images stored in an accessible url. You basically import the image url for each product and then do a bulk download from the list view.

Check it out from here and let me know if this will simplify your work.


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 4/9/13, 3:33 AM
Seen: 6671 times
Last updated: 6/16/16, 12:37 AM